Skip to content

Commit

Permalink
lcldec: Check length before unsigned subtraction.
Browse files Browse the repository at this point in the history
Fix integer overflow and out of array read

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <[email protected]>
  • Loading branch information
michaelni committed Jan 24, 2013
1 parent 69fb605 commit b53ed19
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions libavcodec/lcldec.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,10 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
;
} else if (c->flags & FLAG_MULTITHREAD) {
mthread_inlen = AV_RL32(encoded);
if (len < 8) {
av_log(avctx, AV_LOG_ERROR, "len %d is too small\n", len);
return AVERROR_INVALIDDATA;
}
mthread_inlen = FFMIN(mthread_inlen, len - 8);
mthread_outlen = AV_RL32(encoded+4);
mthread_outlen = FFMIN(mthread_outlen, c->decomp_size);
Expand Down

0 comments on commit b53ed19

Please sign in to comment.