[FFmpeg-cvslog] avcodec/dynamic_hdr10_plus: check size before using it

Limin Wang git at videolan.org
Wed Sep 22 04:36:18 EEST 2021


ffmpeg | branch: master | Limin Wang <lance.lmwang at gmail.com> | Mon Sep 13 20:27:05 2021 +0800| [a487635b85d856ac3b02d4b2babe40279155cc9a] | committer: Limin Wang

avcodec/dynamic_hdr10_plus: check size before using it

Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
Signed-off-by: Limin Wang <lance.lmwang at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a487635b85d856ac3b02d4b2babe40279155cc9a
---

 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 854e70d455..34a44aac65 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) {



More information about the ffmpeg-cvslog mailing list