[FFmpeg-devel] [PATCH] avcodec/cbs_av1: add a range check to tg_end

Mark Thompson sw at jkqxz.net
Tue Oct 27 22:09:12 EET 2020


On 27/10/2020 13:49, James Almer wrote:
> Section 6.10.1 of the AV1 spec states:
> 
> It is a requirement of bitstream conformance that the value of tg_end is greater than or equal to tg_start.
> 
> Signed-off-by: James Almer <jamrial at gmail.com>
> ---
>   libavcodec/cbs_av1_syntax_template.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/cbs_av1_syntax_template.c b/libavcodec/cbs_av1_syntax_template.c
> index 2df5619279..63b4db7853 100644
> --- a/libavcodec/cbs_av1_syntax_template.c
> +++ b/libavcodec/cbs_av1_syntax_template.c
> @@ -1785,7 +1785,7 @@ static int FUNC(tile_group_obu)(CodedBitstreamContext *ctx, RWContext *rw,
>           tile_bits = cbs_av1_tile_log2(1, priv->tile_cols) +
>                       cbs_av1_tile_log2(1, priv->tile_rows);
>           fb(tile_bits, tg_start);
> -        fb(tile_bits, tg_end);
> +        fc(tile_bits, tg_end, current->tg_start, MAX_UINT_BITS(tile_bits));
>       }
>   
>       CHECK(FUNC(byte_alignment)(ctx, rw));
> 

This looks good.

I think the upper bound on tg_end can be num_tiles - 1 rather than accepting any value of tile_bits.  Can we sensibly bound tg_start as well?

Thanks,

- Mark


More information about the ffmpeg-devel mailing list