h265: fix a crash in set_aux_data. [1/1]
authorGan Zhang <gan.zhang@amlogic.com>
Thu, 30 Jul 2020 02:41:52 +0000 (10:41 +0800)
committergan.zhang <gan.zhang@amlogic.com>
Tue, 29 Sep 2020 02:43:43 +0000 (10:43 +0800)
PD#SWPL-32695

Problem:
aux data Size exceeds the allocated buff size.

Solution:
When the size exceeds the allocated size, set aux size to 0.

Verify:
U215

Change-Id: Ic15a60b95f8061c93a2ee7c96e23466e42a4d110
Signed-off-by: Gan Zhang <gan.zhang@amlogic.com>
drivers/frame_provider/decoder/h265/vh265.c

index cdc36545142fb7c13cf7701c392122a8ca4b73b3..d79390c69ac4341bd2f946d23bc0296965f7feb7 100644 (file)
@@ -6165,6 +6165,12 @@ static void set_aux_data(struct hevc_state_s *hevc,
                        __func__, pic, pic->aux_data_size,
                        aux_count, suffix_flag, dv_meta_flag);
        }
+
+       if (aux_count > aux_size) {
+               hevc_print(hevc, 0,
+                       "%s:aux_count(%d) is over size\n", __func__, aux_count);
+               aux_count = 0;
+       }
        if (aux_size > 0 && aux_count > 0) {
                int heads_size = 0;
                int new_size;