matroskadec: Check EBML lace sizes.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
pull/21/head
Michael Niedermayer 12 years ago
parent 115c3bc41f
commit 3b93bea9e3
  1. 8
      libavformat/matroskadec.c

@ -2027,10 +2027,10 @@ static int matroska_parse_laces(MatroskaDemuxContext *matroska, uint8_t **buf,
uint64_t num;
uint64_t total;
n = matroska_ebmlnum_uint(matroska, data, size, &num);
if (n < 0) {
if (n < 0 || num > INT_MAX) {
av_log(matroska->ctx, AV_LOG_INFO,
"EBML block data error\n");
res = n;
res = n<0 ? n : AVERROR_INVALIDDATA;
break;
}
data += n;
@ -2040,10 +2040,10 @@ static int matroska_parse_laces(MatroskaDemuxContext *matroska, uint8_t **buf,
int64_t snum;
int r;
r = matroska_ebmlnum_sint(matroska, data, size, &snum);
if (r < 0) {
if (r < 0 || lace_size[n - 1] + snum > (uint64_t)INT_MAX) {
av_log(matroska->ctx, AV_LOG_INFO,
"EBML block data error\n");
res = r;
res = r<0 ? r : AVERROR_INVALIDDATA;
break;
}
data += r;

Loading…
Cancel
Save