[FFmpeg-devel] [PATCH 3/3] avcodec/dynamic_hdr10_plus: check size before using it

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Tue Sep 21 07:25:26 EEST 2021


lance.lmwang at gmail.com:
> From: Limin Wang <lance.lmwang at gmail.com>
> 
> Signed-off-by: Limin Wang <lance.lmwang at gmail.com>
> ---
>  libavcodec/dynamic_hdr10_plus.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/libavcodec/dynamic_hdr10_plus.c b/libavcodec/dynamic_hdr10_plus.c
> index 854e70d..34a44aa 100644
> --- a/libavcodec/dynamic_hdr10_plus.c
> +++ b/libavcodec/dynamic_hdr10_plus.c
> @@ -40,10 +40,10 @@ int ff_parse_itu_t_t35_to_dynamic_hdr10_plus(AVDynamicHDRPlus *s, const uint8_t
>      if (ret < 0)
>          return ret;
>  
> -    s->application_version = get_bits(gb, 8);
> -
> -    if (get_bits_left(gb) < 2)
> +    if (get_bits_left(gb) < 10)
>          return AVERROR_INVALIDDATA;
> +
> +    s->application_version = get_bits(gb, 8);
>      s->num_windows = get_bits(gb, 2);
>  
>      if (s->num_windows < 1 || s->num_windows > 3) {
> 

LGTM.

- Andreas


More information about the ffmpeg-devel mailing list