[FFmpeg-devel] [PATCH] lavc/vaapi_encode_h265: Suppress the "above array bounds" warning.

Jun Zhao mypopydev at gmail.com
Wed Apr 26 09:44:54 EEST 2017


From f3678e0ceb691b6df5957a2c3d26d4f0d91d4ff5 Mon Sep 17 00:00:00 2001
From: Jun Zhao <jun.zhao at intel.com>
Date: Wed, 26 Apr 2017 14:00:56 +0800
Subject: [PATCH] lavc/vaapi_encode_h265: Suppress the "above array bounds"
 warning.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

setting the layer_id_included_flag lead to a potential array out of bounds,
build warning message as follow:
libavcodec/vaapi_encode_h265.c: In function
‘vaapi_encode_h265_write_sequence_header’:
libavcodec/vaapi_encode_h265.c:305:49: warning: array subscript is above
array bounds [-Warray-bounds]

Signed-off-by: Jun Zhao <jun.zhao at intel.com>
---
 libavcodec/vaapi_encode_h265.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/vaapi_encode_h265.c b/libavcodec/vaapi_encode_h265.c
index 6e008b7b9c..1b2a49806b 100644
--- a/libavcodec/vaapi_encode_h265.c
+++ b/libavcodec/vaapi_encode_h265.c
@@ -66,7 +66,7 @@ typedef struct VAAPIEncodeH265MiscSequenceParams {
     unsigned int vps_num_layer_sets_minus1;
     unsigned int sps_max_sub_layers_minus1;
     char sps_temporal_id_nesting_flag;
-    char layer_id_included_flag[MAX_LAYERS][64];
+    char layer_id_included_flag[MAX_LAYERS+1][64];
 
     // Profile/tier/level parameters.
     char general_profile_compatibility_flag[32];
-- 
2.11.0



More information about the ffmpeg-devel mailing list