[FFmpeg-cvslog] avformat/avidec: Fix infinite loop in avi_read_nikon()

Michael Niedermayer git at videolan.org
Sun Sep 18 01:53:40 EEST 2016


ffmpeg | branch: release/2.8 | Michael Niedermayer <michael at niedermayer.cc> | Fri Sep  2 12:19:29 2016 +0200| [8ddeae57ae727966ac7588cf34ff56558fe3ffd1] | committer: Michael Niedermayer

avformat/avidec: Fix infinite loop in avi_read_nikon()

Fixes: 360/test.poc

Found-by: 连一汉 <lianyihan at 360.cn>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit e4e4a9cad7f21593d4bcb1f2404ea0d373c36c43)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavformat/avidec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index 5366847..97dbaef 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -344,14 +344,14 @@ static void avi_metadata_creation_time(AVDictionary **metadata, char *date)
 
 static void avi_read_nikon(AVFormatContext *s, uint64_t end)
 {
-    while (avio_tell(s->pb) < end) {
+    while (avio_tell(s->pb) < end && !avio_feof(s->pb)) {
         uint32_t tag  = avio_rl32(s->pb);
         uint32_t size = avio_rl32(s->pb);
         switch (tag) {
         case MKTAG('n', 'c', 't', 'g'):  /* Nikon Tags */
         {
             uint64_t tag_end = avio_tell(s->pb) + size;
-            while (avio_tell(s->pb) < tag_end) {
+            while (avio_tell(s->pb) < tag_end && !avio_feof(s->pb)) {
                 uint16_t tag     = avio_rl16(s->pb);
                 uint16_t size    = avio_rl16(s->pb);
                 const char *name = NULL;



More information about the ffmpeg-cvslog mailing list