From 62f72b40c0b0d2cd6a2b81977287fa01d9f4ca6d Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Tue, 24 Nov 2015 01:24:47 +0100 Subject: [PATCH] nut: Provide more information on failure --- libavformat/nutdec.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c index bf1ab7b933..e560a7e8ee 100644 --- a/libavformat/nutdec.c +++ b/libavformat/nutdec.c @@ -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);