Skip to content

Commit

Permalink
avcodec/mpeg4videodec: Clear bits_per_raw_sample if it has originated…
Browse files Browse the repository at this point in the history
… 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>
  • Loading branch information
michaelni committed Jun 13, 2018
1 parent 30af29a commit 2fc108f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions libavcodec/mpeg4videodec.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

1 comment on commit 2fc108f

@thuanpv
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is CVE-2018-12459

Please sign in to comment.