Commit a2e25634 authored by conrad's avatar conrad

matroskadec: Fix a buffer overread

git-svn-id: file:///var/local/repositories/ffmpeg/trunk@22271 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent f539f9fc
...@@ -1676,6 +1676,11 @@ static int matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data, ...@@ -1676,6 +1676,11 @@ static int matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data,
int offset = 0, pkt_size = lace_size[n]; int offset = 0, pkt_size = lace_size[n];
uint8_t *pkt_data = data; uint8_t *pkt_data = data;
if (lace_size[n] > size) {
av_log(matroska->ctx, AV_LOG_ERROR, "Invalid packet size\n");
break;
}
if (encodings && encodings->scope & 1) { if (encodings && encodings->scope & 1) {
offset = matroska_decode_buffer(&pkt_data,&pkt_size, track); offset = matroska_decode_buffer(&pkt_data,&pkt_size, track);
if (offset < 0) if (offset < 0)
...@@ -1727,6 +1732,7 @@ static int matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data, ...@@ -1727,6 +1732,7 @@ static int matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data,
if (timecode != AV_NOPTS_VALUE) if (timecode != AV_NOPTS_VALUE)
timecode = duration ? timecode + duration : AV_NOPTS_VALUE; timecode = duration ? timecode + duration : AV_NOPTS_VALUE;
data += lace_size[n]; data += lace_size[n];
size -= lace_size[n];
} }
} }
......
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