[FFmpeg-devel] [PATCH] Complain about and ignore obviously broken protocol size.

Michael Niedermayer michaelni at gmx.at
Sat Dec 31 18:51:27 CET 2011


On Sat, Dec 31, 2011 at 06:07:23PM +0100, Reimar Döffinger wrote:
> Signed-off-by: Reimar Döffinger <Reimar.Doeffinger at gmx.de>
> ---
>  libavformat/utils.c |   10 +++++++---
>  1 files changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/libavformat/utils.c b/libavformat/utils.c
> index 517b852..9228821 100644
> --- a/libavformat/utils.c
> +++ b/libavformat/utils.c
> @@ -270,11 +270,15 @@ AVInputFormat *av_find_input_format(const char *short_name)
>  int ffio_limit(AVIOContext *s, int size)
>  {
>      if(s->maxsize>=0){
> -        int64_t remaining= s->maxsize - avio_tell(s);
> +        int64_t pos = avio_tell(s);
> +        int64_t remaining= s->maxsize - pos;
>          if(remaining < size){
>              int64_t newsize= avio_size(s);
> -            if(!s->maxsize || s->maxsize<newsize)
> -                s->maxsize= newsize - !newsize;
> +            if(newsize >= 0 && newsize <= pos) {
> +                av_log(0, AV_LOG_ERROR, "Broken protocol implementation, size <= pos\n");

i dont think avio_size() is guranteed to be more than the current
position

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Many things microsoft did are stupid, but not doing something just because
microsoft did it is even more stupid. If everything ms did were stupid they
would be bankrupt already.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20111231/5b6c29f1/attachment.asc>


More information about the ffmpeg-devel mailing list