[FFmpeg-devel] [FFmpeg-cvslog] avcodec/cbs_av1: Avoid shift overflow

Mark Thompson sw at jkqxz.net
Thu May 9 23:38:14 EEST 2024


On 09/05/2024 16:10, Michael Niedermayer wrote:
> ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Wed May  1 21:44:33 2024 +0200| [d7924a4f60f2088de1e6790345caba929eb97030] | committer: Michael Niedermayer
> 
> avcodec/cbs_av1: Avoid shift overflow
> 
> Fixes: CID1465488 Unintentional integer overflow
> 
> Sponsored-by: Sovereign Tech Fund
> Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> 
>> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d7924a4f60f2088de1e6790345caba929eb97030
> ---
> 
>  libavcodec/cbs_av1.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/cbs_av1.c b/libavcodec/cbs_av1.c
> index 1d9ac5ab44..fb82996022 100644
> --- a/libavcodec/cbs_av1.c
> +++ b/libavcodec/cbs_av1.c
> @@ -301,7 +301,7 @@ static int cbs_av1_write_increment(CodedBitstreamContext *ctx, PutBitContext *pb
>          return AVERROR(ENOSPC);
>  
>      if (len > 0)
> -        put_bits(pbc, len, (1 << len) - 1 - (value != range_max));
> +        put_bits(pbc, len, (1U << len) - 1 - (value != range_max));
>  
>      CBS_TRACE_WRITE_END_NO_SUBSCRIPTS();
>  
What syntax element can call this with range_max - range_min == 31?  (Do you have a stream?)

Thanks,

- Mark


More information about the ffmpeg-devel mailing list