Commit 0e239b22 authored by Michael Niedermayer's avatar Michael Niedermayer

xan: check size_segment before reading, fixes out of array read.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent a9456c7c
...@@ -359,17 +359,29 @@ static int xan_wc3_decode_frame(XanContext *s) { ...@@ -359,17 +359,29 @@ static int xan_wc3_decode_frame(XanContext *s) {
case 9: case 9:
case 19: case 19:
if (buf_end - size_segment < 1) {
av_log(s->avctx, AV_LOG_ERROR, "size_segment overread\n");
return AVERROR_INVALIDDATA;
}
size = *size_segment++; size = *size_segment++;
break; break;
case 10: case 10:
case 20: case 20:
if (buf_end - size_segment < 2) {
av_log(s->avctx, AV_LOG_ERROR, "size_segment overread\n");
return AVERROR_INVALIDDATA;
}
size = AV_RB16(&size_segment[0]); size = AV_RB16(&size_segment[0]);
size_segment += 2; size_segment += 2;
break; break;
case 11: case 11:
case 21: case 21:
if (buf_end - size_segment < 3) {
av_log(s->avctx, AV_LOG_ERROR, "size_segment overread\n");
return AVERROR_INVALIDDATA;
}
size = AV_RB24(size_segment); size = AV_RB24(size_segment);
size_segment += 3; size_segment += 3;
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment