diff options
author | Robert Falkenberg | 2022-05-19 08:49:19 +0200 |
---|---|---|
committer | Robert Falkenberg | 2022-05-19 08:49:19 +0200 |
commit | cd4e6d4b0d0512bb260015774ba4c5c678172a44 (patch) | |
tree | 8d33dc3f8674d9a1777ddbfb236aadf07d357e25 /0004-lib-asn1_utils-fix-out-of-bounds-access-on-zero-size.patch | |
parent | 1f306c136ab1739e0ff3b84e68815c6f2eadad6a (diff) | |
download | aur-cd4e6d4b0d0512bb260015774ba4c5c678172a44.tar.gz |
add patches to support build with GCC 12.1.0
Diffstat (limited to '0004-lib-asn1_utils-fix-out-of-bounds-access-on-zero-size.patch')
-rw-r--r-- | 0004-lib-asn1_utils-fix-out-of-bounds-access-on-zero-size.patch | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/0004-lib-asn1_utils-fix-out-of-bounds-access-on-zero-size.patch b/0004-lib-asn1_utils-fix-out-of-bounds-access-on-zero-size.patch new file mode 100644 index 000000000000..7de6fdf0625b --- /dev/null +++ b/0004-lib-asn1_utils-fix-out-of-bounds-access-on-zero-size.patch @@ -0,0 +1,37 @@ +From 0c9ba5b87ee246b772c9deb2993834f0b7fc088b Mon Sep 17 00:00:00 2001 +From: Robert Falkenberg <robert.falkenberg@srs.io> +Date: Fri, 13 May 2022 16:47:52 +0200 +Subject: [PATCH] lib,asn1_utils: fix out of bounds access on zero-sized array +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +* fix error: ... offset 0 is out of the bounds [0, 0] [-Werror=array-bounds] +* fix note: destination object of size 0 allocated by ‘operator new []’ +--> data_ = new T[cap_]; +--- + lib/include/srsran/asn1/asn1_utils.h | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/lib/include/srsran/asn1/asn1_utils.h b/lib/include/srsran/asn1/asn1_utils.h +index 87696d7b6..f1dcfcd74 100644 +--- a/lib/include/srsran/asn1/asn1_utils.h ++++ b/lib/include/srsran/asn1/asn1_utils.h +@@ -193,8 +193,12 @@ public: + { + size_ = nof_items; + cap_ = nof_items; +- data_ = new T[cap_]; +- std::copy(ptr, ptr + size_, data_); ++ if (ptr != NULL) { ++ data_ = new T[cap_]; ++ std::copy(ptr, ptr + size_, data_); ++ } else { ++ data_ = NULL; ++ } + } + ~dyn_array() + { +-- +2.36.1 + |