[4/5] flvdec: Print a warning in all cases where the index is invalid

Message ID 1329903034-45259-4-git-send-email-martin@martin.st
State Superseded
Headers show

Commit Message

Martin Storsjö Feb. 22, 2012, 9:30 a.m.
From: Michael Niedermayer <michaelni@gmx.at>

---
 libavformat/flvdec.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

Patch

diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index b34f0bf..1ee1ad4 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -179,7 +179,7 @@  static int parse_keyframes_index(AVFormatContext *s, AVIOContext *ioc, AVStream
 
         for (i = 0; i < arraylen && avio_tell(ioc) < max_pos - 1; i++) {
             if (avio_r8(ioc) != AMF_DATA_TYPE_NUMBER)
-                goto finish;
+                goto invalid;
             num_val = av_int2double(avio_rb64(ioc));
             current_array[i] = num_val;
         }
@@ -211,11 +211,13 @@  static int parse_keyframes_index(AVFormatContext *s, AVIOContext *ioc, AVStream
          * broken index.
          */
         if (size0 > filepositions[1] || FFABS(dts - times[1]*1000) > 5000)
-            goto finish;
+            goto invalid;
         for (i = 0; i < fileposlen; i++)
             av_add_index_entry(vstream, filepositions[i], times[i]*1000, 0, 0, AVINDEX_KEYFRAME);
-    } else
+    } else {
+invalid:
         av_log(s, AV_LOG_WARNING, "Invalid keyframes object, skipping.\n");
+    }
 
 finish:
     av_freep(&times);