[FFmpeg-cvslog] avformat/rmdec: add some error messages

Michael Niedermayer git at videolan.org
Thu Oct 24 17:16:30 CEST 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Thu Oct 24 17:05:57 2013 +0200| [aaf02f6ede55a50375a99ed1ef6d1df964912530] | committer: Michael Niedermayer

avformat/rmdec: add some error messages

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavformat/rmdec.c |   17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c
index 42fbb9c..10beeb6 100644
--- a/libavformat/rmdec.c
+++ b/libavformat/rmdec.c
@@ -680,16 +680,20 @@ static int rm_assemble_video_frame(AVFormatContext *s, AVIOContext *pb,
         pos  = get_num(pb, &len);
         pic_num = avio_r8(pb); len--;
     }
-    if(len<0)
+    if(len<0) {
+        av_log(s, AV_LOG_ERROR, "Insuffient data\n");
         return -1;
+    }
     rm->remaining_len = len;
     if(type&1){     // frame, not slice
         if(type == 3){  // frame as a part of packet
             len= len2;
             *timestamp = pos;
         }
-        if(rm->remaining_len < len)
+        if(rm->remaining_len < len) {
+            av_log(s, AV_LOG_ERROR, "Insuffient remaining len\n");
             return -1;
+        }
         rm->remaining_len -= len;
         if(av_new_packet(pkt, len + 9) < 0)
             return AVERROR(EIO);
@@ -698,6 +702,7 @@ static int rm_assemble_video_frame(AVFormatContext *s, AVIOContext *pb,
         AV_WL32(pkt->data + 5, 0);
         if ((ret = avio_read(pb, pkt->data + 9, len)) != len) {
             av_free_packet(pkt);
+            av_log(s, AV_LOG_ERROR, "Failed to read %d bytes\n", len);
             return ret < 0 ? ret : AVERROR(EIO);
         }
         return 0;
@@ -724,14 +729,18 @@ static int rm_assemble_video_frame(AVFormatContext *s, AVIOContext *pb,
     if(type == 2)
         len = FFMIN(len, pos);
 
-    if(++vst->cur_slice > vst->slices)
+    if(++vst->cur_slice > vst->slices) {
+        av_log(s, AV_LOG_ERROR, "cur slice %d, too large\n", vst->cur_slice);
         return 1;
+    }
     if(!vst->pkt.data)
         return AVERROR(ENOMEM);
     AV_WL32(vst->pkt.data - 7 + 8*vst->cur_slice, 1);
     AV_WL32(vst->pkt.data - 3 + 8*vst->cur_slice, vst->videobufpos - 8*vst->slices - 1);
-    if(vst->videobufpos + len > vst->videobufsize)
+    if(vst->videobufpos + len > vst->videobufsize) {
+        av_log(s, AV_LOG_ERROR, "outside videobufsize\n");
         return 1;
+    }
     if (avio_read(pb, vst->pkt.data + vst->videobufpos, len) != len)
         return AVERROR(EIO);
     vst->videobufpos += len;



More information about the ffmpeg-cvslog mailing list