mirror of
https://github.com/mpv-player/mpv
synced 2025-03-25 04:38:01 +00:00
demux_mkv: verify laces separately, and in all cases
This commit is contained in:
parent
1d6558d9c8
commit
59eaa8ed7e
@ -1824,8 +1824,6 @@ static int demux_mkv_read_block_lacing(bstr *buffer, int *laces,
|
||||
goto error;
|
||||
lace_size[i] += t;
|
||||
} while (t == 0xFF);
|
||||
if (lace_size[i] > buffer->len - total || total > buffer->len)
|
||||
goto error;
|
||||
total += lace_size[i];
|
||||
}
|
||||
lace_size[i] = buffer->len - total;
|
||||
@ -1849,14 +1847,22 @@ static int demux_mkv_read_block_lacing(bstr *buffer, int *laces,
|
||||
if (snum == EBML_INT_INVALID)
|
||||
goto error;
|
||||
lace_size[i] = lace_size[i - 1] + snum;
|
||||
if (lace_size[i] > buffer->len - total || total > buffer->len)
|
||||
goto error;
|
||||
total += lace_size[i];
|
||||
}
|
||||
lace_size[i] = buffer->len - total;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
total = buffer->len;
|
||||
for (i = 0; i < *laces; i++) {
|
||||
if (lace_size[i] > total)
|
||||
goto error;
|
||||
total -= lace_size[i];
|
||||
}
|
||||
if (total != 0)
|
||||
goto error;
|
||||
|
||||
return 0;
|
||||
|
||||
error:
|
||||
|
Loading…
Reference in New Issue
Block a user