[FFmpeg-cvslog] r10385 - trunk/libavformat/matroskaenc.c

Rich Felker dalias
Thu Sep 6 17:06:40 CEST 2007


On Wed, Sep 05, 2007 at 02:26:05AM +0200, conrad wrote:
> Author: conrad
> Date: Wed Sep  5 02:26:04 2007
> New Revision: 10385
> 
> Log:
> We shouldn't be passing in sizes larger than 2^56-2, so use an assert
> 
> 
> Modified:
>    trunk/libavformat/matroskaenc.c
> 
> Modified: trunk/libavformat/matroskaenc.c
> ==============================================================================
> --- trunk/libavformat/matroskaenc.c	(original)
> +++ trunk/libavformat/matroskaenc.c	Wed Sep  5 02:26:04 2007
> @@ -131,11 +131,7 @@ static void put_ebml_size(ByteIOContext 
>      int i, needed_bytes = ebml_size_bytes(size);
>  
>      // sizes larger than this are currently undefined in EBML
> -    // so write "unknown" size
> -    if (size >= (1ULL<<56)-1) {
> -        put_ebml_size_unknown(pb, 1);
> -        return;
> -    }
> +    assert(size < (1ULL<<56)-1);

If user code/input calling the muxer could cause a size larger than
this to be passed to the function, then using assert here is illegal!
It could crash the calling application. Instead you must handle the
case or give a fatal error back to the caller, not terminate the
process!

Rich




More information about the ffmpeg-cvslog mailing list