[vlc-devel] [vlc-commits] demux: av1_unpack: fix leb128 width estimation

Steve Lhomme robux4 at ycbcr.xyz
Fri Oct 12 08:29:36 CEST 2018



On 11/10/2018 22:41, Francois Cartegnie wrote:
> vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Oct 11 22:37:44 2018 +0200| [f6994b6a64735308fd9a83fe8032c5be5402dc80] | committer: Francois Cartegnie
>
> demux: av1_unpack: fix leb128 width estimation
>
>> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f6994b6a64735308fd9a83fe8032c5be5402dc80
> ---
>
>   modules/demux/av1_unpack.h | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/modules/demux/av1_unpack.h b/modules/demux/av1_unpack.h
> index 683c53423d..af7f056abf 100644
> --- a/modules/demux/av1_unpack.h
> +++ b/modules/demux/av1_unpack.h
> @@ -26,10 +26,10 @@
>   
>   static inline uint8_t leb128_expected(uint32_t v)

Shouldn't this be at least 64 bits ?

>   {
> -    if     (v < (1U << 8))  return 1;
> -    else if(v < (1U << 15)) return 2;
> -    else if(v < (1U << 22)) return 3;
> -    else if(v < (1U << 29)) return 4;
> +    if     (v < (1U << 7))  return 1;
> +    else if(v < (1U << 14)) return 2;
> +    else if(v < (1U << 21)) return 3;
> +    else if(v < (1U << 28)) return 4;

And test all the way to the amount of bits we have. Malformed files will 
exist (also, fuzzer).

>       else                    return 5;
>   }
>   
>
> _______________________________________________
> vlc-commits mailing list
> vlc-commits at videolan.org
> https://mailman.videolan.org/listinfo/vlc-commits



More information about the vlc-devel mailing list