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

lance.lmwang at gmail.com lance.lmwang at gmail.com
Tue Sep 14 13:50:38 EEST 2021


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



More information about the ffmpeg-devel mailing list