1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2011-12-25 04:48:26 +01:00
parent 964506bb97
commit 27d323577c

View File

@ -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;
}