Browse Source

avcodec/cook: check that the subpacket sizes fit in block_align

Fixes out of array read
Fixes: asan_heap-oob_fb5c50_19_018.rmvb
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
tags/n2.5
Michael Niedermayer 11 years ago
parent
commit
10e32618ac
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      libavcodec/cook.c

+ 2
- 2
libavcodec/cook.c View File

@@ -1215,8 +1215,8 @@ static av_cold int cook_decode_init(AVCodecContext *avctx)

q->num_subpackets++;
s++;
if (s > MAX_SUBPACKETS) {
avpriv_request_sample(avctx, "subpackets > %d", MAX_SUBPACKETS);
if (s > FFMIN(MAX_SUBPACKETS, avctx->block_align)) {
avpriv_request_sample(avctx, "subpackets > %d", FFMIN(MAX_SUBPACKETS, avctx->block_align));
return AVERROR_PATCHWELCOME;
}
}


Loading…
Cancel
Save