diff mbox series

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

Message ID 20201027134939.189-1-jamrial@gmail.com
State Superseded
Headers show
Series [FFmpeg-devel] avcodec/cbs_av1: add a range check to tg_end | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

James Almer Oct. 27, 2020, 1:49 p.m. UTC
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@gmail.com>
---
 libavcodec/cbs_av1_syntax_template.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Mark Thompson Oct. 27, 2020, 8:09 p.m. UTC | #1
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@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
James Almer Oct. 27, 2020, 8:43 p.m. UTC | #2
On 10/27/2020 5:09 PM, Mark Thompson wrote:
> 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@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?

We would need to keep track of the amount of tiles previous groups
contained. A field in CodedBitstreamAV1Context could work for that.

I'll try that and resend.

> 
> Thanks,
> 
> - Mark
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
diff mbox series

Patch

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));