Prevent an infinite loop.

Inspired by a patch from Michael Niedermayer

CC: [email protected]
---
 libavformat/riff.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavformat/riff.c b/libavformat/riff.c
index a4ab75d..40d00e3 100644
--- a/libavformat/riff.c
+++ b/libavformat/riff.c
@@ -788,6 +788,10 @@ int ff_read_riff_info(AVFormatContext *s, int64_t size)
         if (!chunk_code) {
             if (chunk_size)
                 avio_skip(pb, chunk_size);
+            else if (pb->eof_reached) {
+                av_log(s, AV_LOG_WARNING, "truncated file\n");
+                return AVERROR_EOF;
+            }
             continue;
         }
 
-- 
1.8.1.5

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to