diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2018-06-09 22:25:38 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2018-06-15 22:31:13 +0200 |
commit | 897524954be2eba39af71fbb9210236b337270a6 (patch) | |
tree | 703665107e916a0d325f75e72582004fcb04cd86 | |
parent | f0e4bc61e31d9d766920837422fdca95e82f771b (diff) | |
download | ffmpeg-897524954be2eba39af71fbb9210236b337270a6.tar.gz |
avcodec/mpeg4videodec: Clear bits_per_raw_sample if it has originated from a previous instance
Fixes: assertion failure
Fixes: ffmpeg_crash_5.avi
Found-by: Thuan Pham <thuanpv@comp.nus.edu.sg>, Marcel Böhme, Andrew Santosa and Alexandru Razvan Caciulescu with AFLSmart
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 2fc108f60f98cd00813418a8754a46476b404a3c)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/mpeg4videodec.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c index 51b58fac02..d0ebaac6e8 100644 --- a/libavcodec/mpeg4videodec.c +++ b/libavcodec/mpeg4videodec.c @@ -3109,6 +3109,12 @@ int ff_mpeg4_decode_picture_header(Mpeg4DecContext *ctx, GetBitContext *gb) /* search next start code */ align_get_bits(gb); + // If we have not switched to studio profile than we also did not switch bps + // that means something else (like a previous instance) outside set bps which + // would be inconsistant with the currect state, thus reset it + if (!s->studio_profile && s->avctx->bits_per_raw_sample != 8) + s->avctx->bits_per_raw_sample = 0; + if (s->codec_tag == AV_RL32("WV1F") && show_bits(gb, 24) == 0x575630) { skip_bits(gb, 24); if (get_bits(gb, 8) == 0xF0) |