lavf: ffio_limit(), treat avio_size()==0 as error.
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 31 Dec 2011 14:27:51 +0000 (15:27 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 3 Jan 2012 21:44:34 +0000 (22:44 +0100)
This works around issues arising from inputs that claim to have a
filesize of 0.

Reported-by: buzz_
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit e6362f3a3cfbabf457fc7ebb2205cbfc043501ee)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/utils.c

index b59a692..304e364 100644 (file)
@@ -271,7 +271,7 @@ int ffio_limit(AVIOContext *s, int size)
         if(remaining < size){
             int64_t newsize= avio_size(s);
             if(!s->maxsize || s->maxsize<newsize)
-                s->maxsize= newsize;
+                s->maxsize= newsize - !newsize;
             remaining= s->maxsize - avio_tell(s);
             remaining= FFMAX(remaining, 0);
         }