diff --git a/gdb.changes b/gdb.changes index 9a116f3..5875ad2 100644 --- a/gdb.changes +++ b/gdb.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Tue Apr 30 13:24:17 UTC 2024 - Tom de Vries + +- Patch added (swo#31524, bsc#1222188): + * make-pascal_language-print_type-handle-varstring-nul.patch + ------------------------------------------------------------------- Wed Mar 20 09:53:08 UTC 2024 - Richard Biener diff --git a/gdb.spec b/gdb.spec index c42b4dc..27c73b7 100644 --- a/gdb.spec +++ b/gdb.spec @@ -351,6 +351,7 @@ Patch2073: gdb-tdep-fix-nr-array-elements-in-ppc64_aggregate_ca.patch Patch2074: gdb-tui-fix-wmaybe-uninitialized-in-tui_find_disasse.patch Patch2075: gdb-testsuite-add-missing-no-prompt-anchor-in-gdb.ba.patch Patch2076: gdb-testsuite-remove-spurious-in-save_vars.patch +Patch2077: make-pascal_language-print_type-handle-varstring-nul.patch # Backport from gdb-patches @@ -834,6 +835,7 @@ find -name "*.info*"|xargs rm -f %patch -P 2074 -p1 %patch -P 2075 -p1 %patch -P 2076 -p1 +%patch -P 2077 -p1 %patch -P 2100 -p1 %patch -P 2101 -p1 diff --git a/make-pascal_language-print_type-handle-varstring-nul.patch b/make-pascal_language-print_type-handle-varstring-nul.patch new file mode 100644 index 0000000..c838c98 --- /dev/null +++ b/make-pascal_language-print_type-handle-varstring-nul.patch @@ -0,0 +1,43 @@ +From f27cc602d85c46b46f5b02d6f584a1d872e098e3 Mon Sep 17 00:00:00 2001 +From: Tom Tromey +Date: Wed, 27 Mar 2024 10:34:46 -0600 +Subject: [PATCH] Make pascal_language::print_type handle varstring==nullptr + +PR gdb/31524 points out a crash when pascal_language::print_type is +called with varstring==nullptr. This crash is a regression arising +from the printf/pager rewrite -- that indirectly removed a NULL check +from gdb's "puts". + +This patch instead fixes the problem by adding a check to print_type. +Passing nullptr here seems to be expected in other places (e.g., there +is a call to type_print like this in expprint.c), and other +implementations of this method (or related helpers) explicitly check +for NULL. + +I didn't write a test case for this because it seemed like overkill +for a Pascal bug that only occurs with -i=mi. However, if you want +one, let me know and I will do it. + +Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31524 +Approved-By: John Baldwin +--- + gdb/p-typeprint.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/gdb/p-typeprint.c b/gdb/p-typeprint.c +index e8542d6845a..68a94a65f64 100644 +--- a/gdb/p-typeprint.c ++++ b/gdb/p-typeprint.c +@@ -55,7 +55,8 @@ pascal_language::print_type (struct type *type, const char *varstring, + type_print_varspec_prefix (type, stream, show, 0, flags); + } + /* first the name */ +- gdb_puts (varstring, stream); ++ if (varstring != nullptr) ++ gdb_puts (varstring, stream); + + if ((varstring != NULL && *varstring != '\0') + && !(code == TYPE_CODE_FUNC +-- +2.35.3 +