From 75205cb3db4711467d0db7ec7c6c7cd30b73da9c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bernhard=20Rosenkr=C3=A4nzer?=
 <bernhard.rosenkraenzer.ext@huawei.com>
Date: Thu, 2 Sep 2021 18:09:56 +0200
Subject: [PATCH] libgcrypt: Remove -Werror=array-bounds from compiler flags
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

libgcrypt uses zero-length array tricks causing array-bounds warnings.

The warnings have been verified to be harmless in 1.8.5; for extra
security, this should be re-checked after updating.

Removing -Werror=array-bounds here allows us to use -Werror=array-bounds
globally in OPTIMIZE_FOR=security mode.

Signed-off-by: Bernhard Rosenkränzer <bernhard.rosenkraenzer.ext@huawei.com>
---
 .../recipes-support/libgcrypt/libgcrypt_%.bbappend    | 11 +++++++++++
 1 file changed, 11 insertions(+)
 create mode 100644 meta-ohos-core/recipes-support/libgcrypt/libgcrypt_%.bbappend

diff --git a/meta-ohos-core/recipes-support/libgcrypt/libgcrypt_%.bbappend b/meta-ohos-core/recipes-support/libgcrypt/libgcrypt_%.bbappend
new file mode 100644
index 00000000..96704ea8
--- /dev/null
+++ b/meta-ohos-core/recipes-support/libgcrypt/libgcrypt_%.bbappend
@@ -0,0 +1,11 @@
+# SPDX-FileCopyrightText: Huawei Inc.
+# SPDX-License-Identifier: Apache-2.0
+
+# libgcrypt uses zero-length array tricks causing array-bounds warnings.
+# The warnings have been verified to be harmless in 1.8.5; for extra
+# security, this should be re-checked after updating.
+#
+# Removing -Werror=array-bounds here allows us to use -Werror=array-bounds
+# globally in OPTIMIZE_FOR=security mode.
+
+TARGET_CFLAGS_remove = "-Werror=array-bounds"
-- 
GitLab