aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/avidec.c
diff options
context:
space:
mode:
authorBenoit Fouet <benoit.fouet@free.fr>2014-09-22 09:57:37 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-09-22 11:01:27 +0200
commit9c843fb1d0810626194a789eb24a2af404f3be2c (patch)
tree64e86fc2f06255f4c7a30143e4858af01a16661a /libavformat/avidec.c
parent591e06b0e24f5c467547e9b90994268a1b5267f9 (diff)
downloadffmpeg-9c843fb1d0810626194a789eb24a2af404f3be2c.tar.gz
avformat/avidec: ensure that palette does not contain the BottomUp info.
Considering the palette is located at the end of extradata may be flawed when the extradata contains the palette followed by the BottomUp field. When the BottomUp field is present, exclude it from the palette. Fixes part of ticket #1304 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/avidec.c')
-rw-r--r--libavformat/avidec.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index 5b260e2542..f7b15b77a5 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -756,6 +756,10 @@ static int avi_read_header(AVFormatContext *s)
pal_size = FFMIN(pal_size, st->codec->extradata_size);
pal_src = st->codec->extradata +
st->codec->extradata_size - pal_size;
+ /* Exclude the "BottomUp" field from the palette */
+ if (pal_src - st->codec->extradata >= 9 &&
+ !memcmp(st->codec->extradata + st->codec->extradata_size - 9, "BottomUp", 9))
+ pal_src -= 9;
for (i = 0; i < pal_size / 4; i++)
ast->pal[i] = 0xFFU<<24 | AV_RL32(pal_src+4*i);
ast->has_pal = 1;