From 7ea5dbcb83a502d8152d5c64d32f9a16e7e907c7 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 10 Sep 2012 23:28:48 +0200 Subject: cavsdec: Fix assertion failure. The assert in decode_mb_b() is replaced by a normal error check for the case that can occur with a damaged or crafted bitstream. Signed-off-by: Michael Niedermayer --- libavcodec/cavsdec.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'libavcodec') diff --git a/libavcodec/cavsdec.c b/libavcodec/cavsdec.c index 0f4f3acfa3..b0a18c46b9 100644 --- a/libavcodec/cavsdec.c +++ b/libavcodec/cavsdec.c @@ -820,7 +820,11 @@ static void decode_mb_b(AVSContext *h, enum cavs_mb mb_type) { } break; default: - av_assert2((mb_type > B_SYM_16X16) && (mb_type < B_8X8)); + if (mb_type <= B_SYM_16X16) { + av_log(h->s.avctx, AV_LOG_ERROR, "Invalid mb_type %d in B frame\n", mb_type); + return AVERROR_INVALIDDATA; + } + av_assert2(mb_type < B_8X8); flags = ff_cavs_partition_flags[mb_type]; if(mb_type & 1) { /* 16x8 macroblock types */ if(flags & FWD0) -- cgit v1.2.3