Merge commit '62f72b40c0b0d2cd6a2b81977287fa01d9f4ca6d'

* commit '62f72b40c0b0d2cd6a2b81977287fa01d9f4ca6d':
  nut: Provide more information on failure

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
This commit is contained in:
Hendrik Leppkes 2015-11-29 16:16:15 +01:00
commit 2e4d10ae55
1 changed files with 10 additions and 5 deletions

View File

@ -264,7 +264,9 @@ static int decode_main_header(NUTContext *nut)
GET_V(nut->time_base[i].num, tmp > 0 && tmp < (1ULL << 31)); GET_V(nut->time_base[i].num, tmp > 0 && tmp < (1ULL << 31));
GET_V(nut->time_base[i].den, tmp > 0 && tmp < (1ULL << 31)); GET_V(nut->time_base[i].den, tmp > 0 && tmp < (1ULL << 31));
if (av_gcd(nut->time_base[i].num, nut->time_base[i].den) != 1) { if (av_gcd(nut->time_base[i].num, nut->time_base[i].den) != 1) {
av_log(s, AV_LOG_ERROR, "time base invalid\n"); av_log(s, AV_LOG_ERROR, "invalid time base %d/%d\n",
nut->time_base[i].num,
nut->time_base[i].den);
ret = AVERROR_INVALIDDATA; ret = AVERROR_INVALIDDATA;
goto fail; goto fail;
} }
@ -315,7 +317,8 @@ static int decode_main_header(NUTContext *nut)
goto fail; goto fail;
} }
if (tmp_stream >= stream_count) { if (tmp_stream >= stream_count) {
av_log(s, AV_LOG_ERROR, "illegal stream number\n"); av_log(s, AV_LOG_ERROR, "illegal stream number %d >= %d\n",
tmp_stream, stream_count);
ret = AVERROR_INVALIDDATA; ret = AVERROR_INVALIDDATA;
goto fail; goto fail;
} }
@ -344,12 +347,14 @@ static int decode_main_header(NUTContext *nut)
for (i = 1; i < nut->header_count; i++) { for (i = 1; i < nut->header_count; i++) {
uint8_t *hdr; uint8_t *hdr;
GET_V(nut->header_len[i], tmp > 0 && tmp < 256); GET_V(nut->header_len[i], tmp > 0 && tmp < 256);
rem -= nut->header_len[i]; if (rem < nut->header_len[i]) {
if (rem < 0) { av_log(s, AV_LOG_ERROR,
av_log(s, AV_LOG_ERROR, "invalid elision header\n"); "invalid elision header %d : %d > %d\n",
i, nut->header_len[i], rem);
ret = AVERROR_INVALIDDATA; ret = AVERROR_INVALIDDATA;
goto fail; goto fail;
} }
rem -= nut->header_len[i];
hdr = av_malloc(nut->header_len[i]); hdr = av_malloc(nut->header_len[i]);
if (!hdr) { if (!hdr) {
ret = AVERROR(ENOMEM); ret = AVERROR(ENOMEM);