diff options
author | James Almer <jamrial@gmail.com> | 2017-09-28 00:18:10 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2017-09-28 00:28:38 -0300 |
commit | 42f27d1b8eab9ea88d2e9faeb35f72dd72eca7b4 (patch) | |
tree | 0e447ffc5700b355bd8699269726f07d6e2eddb2 /libavformat/asfdec_o.c | |
parent | e2a5fa11b2a20a579d425ce6e162873660333445 (diff) | |
parent | 0539d84d985e811e5989ef27c13f7e2dda0f9b89 (diff) | |
download | ffmpeg-42f27d1b8eab9ea88d2e9faeb35f72dd72eca7b4.tar.gz |
Merge commit '0539d84d985e811e5989ef27c13f7e2dda0f9b89'
* commit '0539d84d985e811e5989ef27c13f7e2dda0f9b89':
asfdec: Account for different Format Data sizes
See 76853a3e0ce4d4ef09ffcca7307991b8db832cd4
Merged-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavformat/asfdec_o.c')
-rw-r--r-- | libavformat/asfdec_o.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/libavformat/asfdec_o.c b/libavformat/asfdec_o.c index 7450ea0f74..86ea962849 100644 --- a/libavformat/asfdec_o.c +++ b/libavformat/asfdec_o.c @@ -691,20 +691,22 @@ static int asf_read_properties(AVFormatContext *s, const GUIDParseTable *g) static int parse_video_info(AVIOContext *pb, AVStream *st) { - uint16_t size; + uint16_t size_asf; // ASF-specific Format Data size + uint32_t size_bmp; // BMP_HEADER-specific Format Data size unsigned int tag; st->codecpar->width = avio_rl32(pb); st->codecpar->height = avio_rl32(pb); avio_skip(pb, 1); // skip reserved flags - size = avio_rl16(pb); // size of the Format Data - tag = ff_get_bmp_header(pb, st, NULL); + size_asf = avio_rl16(pb); + tag = ff_get_bmp_header(pb, st, &size_bmp); st->codecpar->codec_tag = tag; st->codecpar->codec_id = ff_codec_get_id(ff_codec_bmp_tags, tag); + size_bmp = FFMAX(size_asf, size_bmp); - if (size > BMP_HEADER_SIZE) { + if (size_bmp > BMP_HEADER_SIZE) { int ret; - st->codecpar->extradata_size = size - BMP_HEADER_SIZE; + st->codecpar->extradata_size = size_bmp - BMP_HEADER_SIZE; if (!(st->codecpar->extradata = av_malloc(st->codecpar->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE))) { st->codecpar->extradata_size = 0; |