[FFmpeg-cvslog] nut: Provide more information on failure

Luca Barbato git at videolan.org
Sun Nov 29 16:16:33 CET 2015


ffmpeg | branch: master | Luca Barbato <lu_zero at gentoo.org> | Tue Nov 24 01:24:47 2015 +0100| [62f72b40c0b0d2cd6a2b81977287fa01d9f4ca6d] | committer: Luca Barbato

nut: Provide more information on failure

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=62f72b40c0b0d2cd6a2b81977287fa01d9f4ca6d
---

 libavformat/nutdec.c |   15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c
index bf1ab7b..e560a7e 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);



More information about the ffmpeg-cvslog mailing list