avcodec/mpc8: check for overread earlier and abort decoding frame

Signed-off-by: Paul B Mahol <onemda@gmail.com>
pull/283/head
Paul B Mahol 7 years ago
parent 11f8f9547d
commit cc40228255
  1. 5
      libavcodec/mpc8.c

@ -273,6 +273,11 @@ static int mpc8_decode_frame(AVCodecContext * avctx, void *data,
if(maxband > 32) maxband -= 33; if(maxband > 32) maxband -= 33;
} }
if (get_bits_left(gb) < 0) {
*got_frame_ptr = 0;
return buf_size;
}
if(maxband > c->maxbands + 1) { if(maxband > c->maxbands + 1) {
av_log(avctx, AV_LOG_ERROR, "maxband %d too large\n",maxband); av_log(avctx, AV_LOG_ERROR, "maxband %d too large\n",maxband);
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;

Loading…
Cancel
Save