diff mbox series

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

Message ID 1631616638-20151-3-git-send-email-lance.lmwang@gmail.com
State Accepted
Commit a487635b85d856ac3b02d4b2babe40279155cc9a
Headers show
Series [FFmpeg-devel,1/3] avcodec/hevc_sei: check size before using it
Related show

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Limin Wang Sept. 14, 2021, 10:50 a.m. UTC
From: Limin Wang <lance.lmwang@gmail.com>

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
---
 libavcodec/dynamic_hdr10_plus.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Limin Wang Sept. 21, 2021, 4:16 a.m. UTC | #1
On Tue, Sep 14, 2021 at 06:50:38PM +0800, lance.lmwang@gmail.com wrote:
> From: Limin Wang <lance.lmwang@gmail.com>
> 
> Signed-off-by: Limin Wang <lance.lmwang@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) {
> -- 
> 1.8.3.1
> 

will apply this patchset unless there are objections.
Andreas Rheinhardt Sept. 21, 2021, 4:25 a.m. UTC | #2
lance.lmwang@gmail.com:
> From: Limin Wang <lance.lmwang@gmail.com>
> 
> Signed-off-by: Limin Wang <lance.lmwang@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
diff mbox series

Patch

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