[FFmpeg-cvslog] avformat/http: Return an error in case of prematurely ending data

Michael Niedermayer git at videolan.org
Sun Apr 19 13:36:24 CEST 2015


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun Mar 29 00:33:35 2015 +0100| [3668701f96005f4f7fc3145c800911e39351c132] | committer: Michael Niedermayer

avformat/http: Return an error in case of prematurely ending data

Fixes Ticket 4039

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

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

 libavformat/http.c |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/libavformat/http.c b/libavformat/http.c
index bbe5de5..dca1213 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -943,6 +943,14 @@ static int http_buf_read(URLContext *h, uint8_t *buf, int size)
             s->filesize >= 0 && s->off >= s->filesize)
             return AVERROR_EOF;
         len = ffurl_read(s->hd, buf, size);
+        if (!len && (!s->willclose || s->chunksize < 0) &&
+            s->filesize >= 0 && s->off < s->filesize) {
+            av_log(h, AV_LOG_ERROR,
+                   "Streams ends prematurly at %"PRId64", should be %"PRId64"\n",
+                   s->off, s->filesize
+                  );
+            return AVERROR(EIO);
+        }
     }
     if (len > 0) {
         s->off += len;



More information about the ffmpeg-cvslog mailing list