diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-04-26 04:12:43 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-04-26 04:21:15 +0200 |
commit | 3788a3c0c03585b0f8180a16d2a15b8e0e033313 (patch) | |
tree | 29000a340cfd9aff729c7853f06152d6756c7219 /libavformat | |
parent | 05815b3545c2f8718ab25f455d51ea88be43e9c5 (diff) | |
parent | f80b381bfd956e4470bdbc1854f88cf3ea0764a9 (diff) | |
download | ffmpeg-3788a3c0c03585b0f8180a16d2a15b8e0e033313.tar.gz |
Merge remote branch 'qatar/master'
* qatar/master:
graphparser: add a NULL check on the argument passed to strstr
setdar: prefer "sar" over "par" in log info message
fade: fix draw_slice() check on fade->factor value
fade: make draw_slice() chroma check against planes 1 and 2
win32: include the correct header in cmdutils.c
ac3: fix memleak in fixed-point encoder
flashsv: Return more meaningful error values.
flashsv: Employ explicit AVCodec struct initializers.
read AVI palette from the end of extradata
cosmetics: K&R coding style and more whitespace for Flash Screen Video
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/avidec.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/libavformat/avidec.c b/libavformat/avidec.c index d8df55b591..97b392aef4 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -592,12 +592,16 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) /* This code assumes that extradata contains only palette. */ /* This is true for all paletted codecs implemented in FFmpeg. */ if (st->codec->extradata_size && (st->codec->bits_per_coded_sample <= 8)) { + int pal_size = (1 << st->codec->bits_per_coded_sample) << 2; + const uint8_t *pal_src; + + pal_size = FFMIN(pal_size, st->codec->extradata_size); + pal_src = st->codec->extradata + st->codec->extradata_size - pal_size; #if HAVE_BIGENDIAN - for (i = 0; i < FFMIN(st->codec->extradata_size, AVPALETTE_SIZE)/4; i++) - ast->pal[i] = av_bswap32(((uint32_t*)st->codec->extradata)[i]); + for (i = 0; i < pal_size/4; i++) + ast->pal[i] = AV_RL32(pal_src+4*i); #else - memcpy(ast->pal, st->codec->extradata, - FFMIN(st->codec->extradata_size, AVPALETTE_SIZE)); + memcpy(ast->pal, pal_src, pal_size); #endif ast->has_pal = 1; } |