X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Frv10.c;h=6050d5e9f233c88ee16a17ef5dfbbea769883fe7;hb=7ff1a4b10f2d7f9a4ae1c72e1259b4ed7d13e316;hp=2334fd1f1261bd5470e057b094d1acbc4f76890a;hpb=cd6a8618b1f57a37e6bc639651fe5a657663409b;p=ffmpeg diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c index 2334fd1f126..6050d5e9f23 100644 --- a/libavcodec/rv10.c +++ b/libavcodec/rv10.c @@ -497,7 +497,7 @@ static av_cold int rv10_decode_init(AVCodecContext *avctx) } if(avctx->debug & FF_DEBUG_PICT_INFO){ - av_log(avctx, AV_LOG_DEBUG, "ver:%X ver0:%X\n", rv->sub_id, avctx->extradata_size >= 4 ? ((uint32_t*)avctx->extradata)[0] : -1); + av_log(avctx, AV_LOG_DEBUG, "ver:%X ver0:%X\n", rv->sub_id, ((uint32_t*)avctx->extradata)[0]); } avctx->pix_fmt = AV_PIX_FMT_YUV420P; @@ -505,7 +505,7 @@ static av_cold int rv10_decode_init(AVCodecContext *avctx) if (ff_MPV_common_init(s) < 0) return -1; - ff_h263_decode_init_vlc(s); + ff_h263_decode_init_vlc(); /* init rv vlc */ if (!done) { @@ -695,11 +695,15 @@ static int rv10_decode_frame(AVCodecContext *avctx, if(!avctx->slice_count){ slice_count = (*buf++) + 1; buf_size--; + + if (!slice_count || buf_size <= 8 * slice_count) { + av_log(avctx, AV_LOG_ERROR, "Invalid slice count: %d.\n", slice_count); + return AVERROR_INVALIDDATA; + } + slices_hdr = buf + 4; buf += 8 * slice_count; buf_size -= 8 * slice_count; - if (buf_size <= 0) - return AVERROR_INVALIDDATA; }else slice_count = avctx->slice_count;