Message ID | 20200126051028.27455-1-andreas.rheinhardt@gmail.com |
---|---|
State | Accepted |
Headers | show |
Series | Matroska muxer patches | expand |
Context | Check | Description |
---|---|---|
andriy/ffmpeg-patchwork | success | Make fate finished |
On Sun, Jan 26, 2020 at 06:10:27AM +0100, Andreas Rheinhardt wrote: > Don't read a 64bit number before having checked that the data is at > least 8 bytes long. > > Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> > --- > libavformat/matroskaenc.c | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) will apply thx [...]
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 444032b431..8fc672a31f 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -2100,9 +2100,13 @@ static void 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) {
Don't read a 64bit number before having checked that the data is at least 8 bytes long. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> --- libavformat/matroskaenc.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)