summaryrefslogtreecommitdiff
path: root/libavformat/http.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-03-29 00:33:35 +0100
committerMichael Niedermayer <michaelni@gmx.at>2015-04-19 13:01:48 +0200
commit3668701f96005f4f7fc3145c800911e39351c132 (patch)
treeb1fd2ce1086f9c92ec9393525eef38c0eb7b1abb /libavformat/http.c
parenta40cee03a3be131729e0c06e4825d14ac2076b03 (diff)
avformat/http: Return an error in case of prematurely ending data
Fixes Ticket 4039 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/http.c')
-rw-r--r--libavformat/http.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/libavformat/http.c b/libavformat/http.c
index bbe5de5cf1..dca1213511 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;