user debian-rele...@lists.debian.org
usertags 1016229 + bsp-2022-10-de-karlsruhe
tags 1016229 + patch
thank you

Hi,

the failures to build the tests are already fixed in the
upstream repository.
I attached a patch that imports the two fixes.

Kind regards,
  Reiner
>From 9953f3cddd2bf3dfcd46d2e0be5e03879daa4e71 Mon Sep 17 00:00:00 2001
From: Reiner Herrmann <rei...@reiner-h.de>
Date: Sat, 15 Oct 2022 14:56:08 +0200
Subject: [PATCH] Import patches to fix FTBFS of unittests

Closes: #1016229
---
 debian/patches/gcc12_encdedstreamtest.patch | 22 +++++++++++++
 debian/patches/gcc12_valuetest.patch        | 34 +++++++++++++++++++++
 debian/patches/series                       |  2 ++
 3 files changed, 58 insertions(+)
 create mode 100644 debian/patches/gcc12_encdedstreamtest.patch
 create mode 100644 debian/patches/gcc12_valuetest.patch

diff --git a/debian/patches/gcc12_encdedstreamtest.patch b/debian/patches/gcc12_encdedstreamtest.patch
new file mode 100644
index 0000000..e585491
--- /dev/null
+++ b/debian/patches/gcc12_encdedstreamtest.patch
@@ -0,0 +1,22 @@
+From 2b2c80450031028439ba2a17a09ef5aa10f2159b Mon Sep 17 00:00:00 2001
+From: Tom Briden <t...@decompile.me.uk>
+Date: Sun, 15 May 2022 10:20:21 +0100
+Subject: [PATCH] encdedstreamtest: fix use-after-free compile error with
+ gcc-12
+
+---
+ test/unittest/encodedstreamtest.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/test/unittest/encodedstreamtest.cpp
++++ b/test/unittest/encodedstreamtest.cpp
+@@ -113,8 +113,8 @@
+                 EXPECT_EQ(expected, actual);
+             }
+             EXPECT_EQ('\0', s.Peek());
+-            free(data);
+             EXPECT_EQ(size, eis.Tell());
++            free(data);
+         }
+     }
+ 
diff --git a/debian/patches/gcc12_valuetest.patch b/debian/patches/gcc12_valuetest.patch
new file mode 100644
index 0000000..dc77db5
--- /dev/null
+++ b/debian/patches/gcc12_valuetest.patch
@@ -0,0 +1,34 @@
+From 1f59c69cd18cd508395fe0bb5c2f8ee909e3c48d Mon Sep 17 00:00:00 2001
+From: Tom Briden <t...@decompile.me.uk>
+Date: Sun, 15 May 2022 10:15:26 +0100
+Subject: [PATCH] valuetest: fix potential write of terminating nul past the
+ end of the destination
+
+Fixes 2 compile errors with gcc-12, eg:
+
+tesunittest/valuetest.cpp:1516:30: error: 'sprintf' may write a terminating nul past the end of the destination [-Werror=format-overflow=]
+test/unittest/valuetest.cpp:1516:20: note: 'sprintf' output between 2 and 11 bytes into a destination of size 10
+---
+ test/unittest/valuetest.cpp | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/test/unittest/valuetest.cpp
++++ b/test/unittest/valuetest.cpp
+@@ -1512,7 +1512,7 @@
+     {
+         int i = 0;
+         for (auto& m : x.GetObject()) {
+-            char name[10];
++            char name[11];
+             sprintf(name, "%d", i);
+             EXPECT_STREQ(name, m.name.GetString());
+             EXPECT_EQ(i, m.value.GetInt());
+@@ -1523,7 +1523,7 @@
+     {
+         int i = 0;
+         for (const auto& m : const_cast<const Value&>(x).GetObject()) {
+-            char name[10];
++            char name[11];
+             sprintf(name, "%d", i);
+             EXPECT_STREQ(name, m.name.GetString());
+             EXPECT_EQ(i, m.value.GetInt());
diff --git a/debian/patches/series b/debian/patches/series
index a2e78c3..a2d3247 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -10,3 +10,5 @@ python3.diff
 0001-support-IBM-PowerPC-ppc64-ppc64le-and-XL-compiler.patch
 0001-CMake-do-not-pass-march-native-or-mcpu-native-when-c.patch
 deal-with-Werror-type-limits.patch
+gcc12_encdedstreamtest.patch
+gcc12_valuetest.patch
-- 
2.37.2

Reply via email to