nut: Provide more information on failure

This commit is contained in:
Luca Barbato 2015-11-24 01:24:47 +01:00
parent 2c17fb61ce
commit 62f72b40c0
1 changed files with 10 additions and 5 deletions

View File

@ -238,7 +238,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].den, tmp > 0 && tmp < (1ULL << 31));
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);
return AVERROR_INVALIDDATA;
}
}
@ -281,7 +283,8 @@ static int decode_main_header(NUTContext *nut)
return AVERROR_INVALIDDATA;
}
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);
return AVERROR_INVALIDDATA;
}
@ -309,11 +312,13 @@ static int decode_main_header(NUTContext *nut)
for (i = 1; i < nut->header_count; i++) {
uint8_t *hdr;
GET_V(nut->header_len[i], tmp > 0 && tmp < 256);
rem -= nut->header_len[i];
if (rem < 0) {
av_log(s, AV_LOG_ERROR, "invalid elision header\n");
if (rem < nut->header_len[i]) {
av_log(s, AV_LOG_ERROR,
"invalid elision header %d : %d > %d\n",
i, nut->header_len[i], rem);
return AVERROR_INVALIDDATA;
}
rem -= nut->header_len[i];
hdr = av_malloc(nut->header_len[i]);
if (!hdr)
return AVERROR(ENOMEM);