Commit 6e9cc964 authored by Andreas Rheinhardt's avatar Andreas Rheinhardt Committed by Michael Niedermayer

avformat/matroskaenc: Check BlockAdditional size before use

Don't read a 64bit number before having checked that the data is at
least 8 bytes long.
Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent b49af89e
......@@ -2142,9 +2142,13 @@ static int mkv_write_block(AVFormatContext *s, AVIOContext *pb,
AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL,
&side_data_size);
if (side_data) {
additional_id = AV_RB64(side_data);
side_data += 8;
side_data_size -= 8;
if (side_data_size < 8) {
side_data_size = 0;
} else {
additional_id = AV_RB64(side_data);
side_data += 8;
side_data_size -= 8;
}
}
if ((side_data_size && additional_id == 1) || discard_padding) {
......
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