aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2021-02-27 14:14:11 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-03-01 11:12:12 +0000
commit06f298e6d1777093b61baef3873813a809b010bd (patch)
tree88b47060063cf730528f65fa653244c8ca972a87
parentcd4fe4ec658ce4861fc970149f78b0ca7fda8fe0 (diff)
downloadopenembedded-core-contrib-06f298e6d1777093b61baef3873813a809b010bd.tar.gz
openembedded-core-contrib-06f298e6d1777093b61baef3873813a809b010bd.tar.bz2
openembedded-core-contrib-06f298e6d1777093b61baef3873813a809b010bd.zip
puzzles: Fix stringop-overflow warning
gcc11 is pedantic about it and finds a case where this maybe used uninitialized Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-sato/puzzles/files/0001-map-Fix-stringop-overflow-warning.patch42
-rw-r--r--meta/recipes-sato/puzzles/puzzles_git.bb1
2 files changed, 43 insertions, 0 deletions
diff --git a/meta/recipes-sato/puzzles/files/0001-map-Fix-stringop-overflow-warning.patch b/meta/recipes-sato/puzzles/files/0001-map-Fix-stringop-overflow-warning.patch
new file mode 100644
index 0000000000..a02d8732ab
--- /dev/null
+++ b/meta/recipes-sato/puzzles/files/0001-map-Fix-stringop-overflow-warning.patch
@@ -0,0 +1,42 @@
+From 3d78d4cffcdc1242892b6c21c26d1c96938c48d1 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sat, 27 Feb 2021 10:02:43 -0800
+Subject: [PATCH] map: Fix stringop-overflow warning
+
+Fixes
+
+../git/map.c: In function 'new_game_desc':
+../git/map.c:1663:23: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
+ 1663 | ret[retlen++] = ',';
+ | ~~~~~~~~~~~~~~^~~~~
+../git/./map.c: In function 'new_game_desc':
+../git/./map.c:1663:23: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
+ 1663 | ret[retlen++] = ',';
+ | ~~~~~~~~~~~~~~^~~~~
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ map.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/map.c b/map.c
+index 412305c..fa0c493 100644
+--- a/map.c
++++ b/map.c
+@@ -1659,8 +1659,10 @@ static char *new_game_desc(const game_params *params, random_state *rs,
+ }
+ }
+
+- ret[retlen++] = 'a'-1 + run;
+- ret[retlen++] = ',';
++ if(ret != NULL) {
++ ret[retlen++] = 'a'-1 + run;
++ ret[retlen++] = ',';
++ }
+
+ run = 0;
+ for (i = 0; i < n; i++) {
+--
+2.30.1
+
diff --git a/meta/recipes-sato/puzzles/puzzles_git.bb b/meta/recipes-sato/puzzles/puzzles_git.bb
index 5b65cf8655..ecc2b9844d 100644
--- a/meta/recipes-sato/puzzles/puzzles_git.bb
+++ b/meta/recipes-sato/puzzles/puzzles_git.bb
@@ -15,6 +15,7 @@ SRC_URI = "git://git.tartarus.org/simon/puzzles.git \
file://0001-pattern.c-Change-string-lenght-parameter-to-be-size_.patch \
file://fix-ki-uninitialized.patch \
file://0001-malloc-Check-for-excessive-values-to-malloc.patch \
+ file://0001-map-Fix-stringop-overflow-warning.patch \
"
UPSTREAM_CHECK_COMMITS = "1"