SHA256
9
0
forked from pool/gdb
Files
gdb/fix-crash-in-f-typeprint.c.patch
Tom de Vries fcf6764793 Fix bsc#1251213
- Patches added:
  * avoid-crash-with-length.patch
  * correct-bounds-check-when-working-around-gas-dwarf-5.patch
  * fix-crash-in-f-typeprint.c.patch
- Patches added (swo#33560, bsc#1251213):
  * bfd-elf-handle-prstatus-of-156-bytes-in-elf32_arm_na.patch
  * gdb-corefiles-fix-segfault-in-add_thread_silent.patch
- Patches added (swo#32542, swo#33354):
  * change-return-value-of-_bfd_mmap_temporary.patch
- Patches added (swo#33068, swo#33069):
  * gdb-fix-handling-of-aborted-inferior-call.patch
- Patches added (swo#33620):
  * gdb-rust-fix-handling-of-unsigned-discriminant.patch
- Patches added (swo#33444):
  * have-gdb.threadexitedevent-inherit-from-gdb.threadev.patch
- Patches added (swo#33617):
  * mark-pascal-as-case-insensitive.patch
- Patches added (testsuite):
  * check-gnatmake-version-in-gnat_version_compare.patch
  * gdb-testsuite-fix-build-id-check-in-gdb.python-py-mi.patch
  * gdb-testsuite-fix-gdb.mi-mi-sym-info.exp.patch
  * gdb-testsuite-fix-gdb.rust-methods.exp-on-i686-linux.patch
  * gdb-testsuite-fix-main-in-gdb.trace-mi-trace-frame-c.patch
  * gdb-testsuite-fix-possible-tcl-errors-in-gdb.threads.patch
  * gdb-testsuite-fix-sizeof-test-in-gdb.rust-simple.exp.patch
  * gdb-testsuite-fix-xfail-in-gdb.ada-array_of_variant..patch
  * gdb-testsuite-fix-xfail-in-gdb.ada-variant_record_fi.patch
  * gdb-testsuite-force-dwarf-in-gdb.pascal.patch
  * gdb-testsuite-rust-fix-for-empty-array.patch
  * gdb-testsuite-use-expect_build_id_in_core_file-a-bit.patch
  * gdb-testsuite-use-std-c99-in-gdb.base-callfuncs.exp.patch
  * gdb-testsuite-use-std-c99-in-gdb.base-nodebug.exp.patch
  * powerpc-mark-rtti-typeid-tests-as-expected-fail-befo.patch
- Maintenance script import-patches.sh:
  * Use git instead of osc.
- Maintenance script qa.sh:
  * Add PR32893 kfail.
2025-11-26 08:34:17 +01:00

57 lines
1.8 KiB
Diff

From a69161a5cbdd93ccd27ea6e07139611039ff3b56 Mon Sep 17 00:00:00 2001
From: Tom Tromey <tom@tromey.com>
Date: Sat, 13 Sep 2025 13:44:10 -0600
Subject: [PATCH 09/25] Fix crash in f-typeprint.c
I noticed a crash in f-typeprint.c that was hidden by an xfail:
XFAIL: gdb.fortran/vla-array.exp: print variable length string array type (GDB internal error) (PRMS gcc/101826)
I think this was introduced by commit 6594ca4a ("do not handle a NULL
linebuffer in pager_file::puts") but not detected due to the xfail.
It seems bad for an xfail to cover up a crash but I haven't
investigated that.
Meanwhile, this patch fixes the crash by checking for a NULL pointer
when calling gdb_puts.
Approved-by: Kevin Buettner <kevinb@redhat.com>
(cherry picked from commit 18400a9cdf6b3d84996a99697a97774f268576c2)
---
gdb/f-typeprint.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c
index 36e434ae5c2..cba7099c0db 100644
--- a/gdb/f-typeprint.c
+++ b/gdb/f-typeprint.c
@@ -414,9 +414,11 @@ f_language::f_type_print_base (struct type *type, struct ui_file *stream,
if (show > 0)
f_type_print_derivation_info (type, stream);
- gdb_puts (" ", stream);
-
- gdb_puts (type->name (), stream);
+ if (type->name () != nullptr)
+ {
+ gdb_puts (" ", stream);
+ gdb_puts (type->name (), stream);
+ }
/* According to the definition,
we only print structure elements in case show > 0. */
@@ -435,7 +437,8 @@ f_language::f_type_print_base (struct type *type, struct ui_file *stream,
gdb_puts ("\n", stream);
}
gdb_printf (stream, "%*sEnd Type ", level, "");
- gdb_puts (type->name (), stream);
+ if (type->name () != nullptr)
+ gdb_puts (type->name (), stream);
}
break;
--
2.51.0