mirror of
https://git.yoctoproject.org/poky
synced 2026-09-29 07:36:20 +02:00
gdb: Fix CVE-2023-39128
Note: The Fix needs to be pushed in gdb rather than bintuils-gdb as we are disabling gdb in binutils configure. Upstream-Status: Backport from [https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=033bc52bb6190393c8eed80925fa78cc35b40c6d] CVE: CVE-2023-39128 (From OE-Core rev: 173d7ab67f14fc6d8b5d46e1c1de39d20965d6e9) Signed-off-by: Siddharth Doshi <sdoshi@mvista.com> Signed-off-by: Steve Sakoman <steve@sakoman.com>
This commit is contained in:
committed by
Steve Sakoman
parent
192ba3d46c
commit
42d270eeed
@@ -14,6 +14,7 @@ SRC_URI = "${GNU_MIRROR}/gdb/gdb-${PV}.tar.xz \
|
|||||||
file://0007-Fix-invalid-sigprocmask-call.patch \
|
file://0007-Fix-invalid-sigprocmask-call.patch \
|
||||||
file://0008-Define-alignof-using-_Alignof-when-using-C11-or-newe.patch \
|
file://0008-Define-alignof-using-_Alignof-when-using-C11-or-newe.patch \
|
||||||
file://add-missing-ldflags.patch \
|
file://add-missing-ldflags.patch \
|
||||||
|
file://0009-CVE-2023-39128.patch \
|
||||||
"
|
"
|
||||||
SRC_URI[sha256sum] = "fd5bebb7be1833abdb6e023c2f498a354498281df9d05523d8915babeb893f0a"
|
SRC_URI[sha256sum] = "fd5bebb7be1833abdb6e023c2f498a354498281df9d05523d8915babeb893f0a"
|
||||||
|
|
||||||
|
|||||||
75
meta/recipes-devtools/gdb/gdb/0009-CVE-2023-39128.patch
Normal file
75
meta/recipes-devtools/gdb/gdb/0009-CVE-2023-39128.patch
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
From 033bc52bb6190393c8eed80925fa78cc35b40c6d Mon Sep 17 00:00:00 2001
|
||||||
|
From: Tom Tromey <tromey@adacore.com>
|
||||||
|
Date: Wed, 16 Aug 2023 11:29:19 -0600
|
||||||
|
Subject: [PATCH] Avoid buffer overflow in ada_decode
|
||||||
|
|
||||||
|
A bug report pointed out a buffer overflow in ada_decode, which Keith
|
||||||
|
helpfully analyzed. ada_decode had a logic error when the input was
|
||||||
|
all digits. While this isn't valid -- and would probably only appear
|
||||||
|
in fuzzer tests -- it still should be handled properly.
|
||||||
|
|
||||||
|
This patch adds a missing bounds check. Tested with the self-tests in
|
||||||
|
an asan build.
|
||||||
|
|
||||||
|
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30639
|
||||||
|
Reviewed-by: Keith Seitz <keiths@redhat.com>
|
||||||
|
|
||||||
|
Upstream-Status: Backport from [https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=033bc52bb6190393c8eed80925fa78cc35b40c6d]
|
||||||
|
CVE: CVE-2023-39128
|
||||||
|
Signed-off-by: Siddharth Doshi <sdoshi@mvista.com>
|
||||||
|
---
|
||||||
|
gdb/ada-lang.c | 19 ++++++++++++++++++-
|
||||||
|
1 file changed, 18 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
|
||||||
|
index 40f8591..06ac46b 100644
|
||||||
|
--- a/gdb/ada-lang.c
|
||||||
|
+++ b/gdb/ada-lang.c
|
||||||
|
@@ -57,6 +57,7 @@
|
||||||
|
#include "cli/cli-utils.h"
|
||||||
|
#include "gdbsupport/function-view.h"
|
||||||
|
#include "gdbsupport/byte-vector.h"
|
||||||
|
+#include "gdbsupport/selftest.h"
|
||||||
|
#include <algorithm>
|
||||||
|
#include "ada-exp.h"
|
||||||
|
#include "charset.h"
|
||||||
|
@@ -1388,7 +1389,7 @@ ada_decode (const char *encoded, bool wrap, bool operators)
|
||||||
|
i -= 1;
|
||||||
|
if (i > 1 && encoded[i] == '_' && encoded[i - 1] == '_')
|
||||||
|
len0 = i - 1;
|
||||||
|
- else if (encoded[i] == '$')
|
||||||
|
+ else if (i >= 0 && encoded[i] == '$')
|
||||||
|
len0 = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -1585,6 +1586,18 @@ ada_decode (const char *encoded, bool wrap, bool operators)
|
||||||
|
return decoded;
|
||||||
|
}
|
||||||
|
|
||||||
|
+#ifdef GDB_SELF_TEST
|
||||||
|
+
|
||||||
|
+static void
|
||||||
|
+ada_decode_tests ()
|
||||||
|
+{
|
||||||
|
+ /* This isn't valid, but used to cause a crash. PR gdb/30639. The
|
||||||
|
+ result does not really matter very much. */
|
||||||
|
+ SELF_CHECK (ada_decode ("44") == "44");
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
/* Table for keeping permanent unique copies of decoded names. Once
|
||||||
|
allocated, names in this table are never released. While this is a
|
||||||
|
storage leak, it should not be significant unless there are massive
|
||||||
|
@@ -14084,4 +14097,8 @@ DWARF attribute."),
|
||||||
|
gdb::observers::new_objfile.attach (ada_new_objfile_observer, "ada-lang");
|
||||||
|
gdb::observers::free_objfile.attach (ada_free_objfile_observer, "ada-lang");
|
||||||
|
gdb::observers::inferior_exit.attach (ada_inferior_exit, "ada-lang");
|
||||||
|
+
|
||||||
|
+#ifdef GDB_SELF_TEST
|
||||||
|
+ selftests::register_test ("ada-decode", ada_decode_tests);
|
||||||
|
+#endif
|
||||||
|
}
|
||||||
|
--
|
||||||
|
2.25.1
|
||||||
|
|
||||||
Reference in New Issue
Block a user