Commit 115c3bc4 authored by Michael Niedermayer's avatar Michael Niedermayer

matroskadec: Check for overflows in xiph lace decoding

This also detects errors earlier
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 14de77d6
......@@ -1992,18 +1992,18 @@ static int matroska_parse_laces(MatroskaDemuxContext *matroska, uint8_t **buf,
uint32_t total = 0;
for (n = 0; res == 0 && n < *laces - 1; n++) {
while (1) {
if (size == 0) {
if (size <= total) {
res = AVERROR_INVALIDDATA;
break;
}
temp = *data;
total += temp;
lace_size[n] += temp;
data += 1;
size -= 1;
if (temp != 0xff)
break;
}
total += lace_size[n];
}
if (size <= total) {
res = AVERROR_INVALIDDATA;
......
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