[FFmpeg-cvslog] avio: Fix ffio_limit() when due to seeking past the end less than 0 bytes remain.

Michael Niedermayer git at videolan.org
Sun Dec 25 05:02:27 CET 2011


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun Dec 25 04:48:26 2011 +0100| [27d323577c19af218f8a5ac33364f213b623a023] | committer: Michael Niedermayer

avio: Fix ffio_limit() when due to seeking past the end less than 0 bytes remain.

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

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

 libavformat/utils.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index db2ca56..7248f91 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -276,9 +276,10 @@ int ffio_limit(AVIOContext *s, int size)
             if(!s->maxsize || s->maxsize<newsize)
                 s->maxsize= newsize;
             remaining= s->maxsize - avio_tell(s);
+            remaining= FFMAX(remaining, 0);
         }
 
-        if(s->maxsize>=0 && remaining>=0 && remaining+1 < size){
+        if(s->maxsize>=0 && remaining+1 < size){
             av_log(0, AV_LOG_ERROR, "Truncating packet of size %d to %"PRId64"\n", size, remaining+1);
             size= remaining+1;
         }



More information about the ffmpeg-cvslog mailing list