public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] gdb/dwarf2: Check for missing abbrev
@ 2024-03-13 20:18 Aaron Merey
  2024-03-14  1:39 ` Simon Marchi
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Aaron Merey @ 2024-03-13 20:18 UTC (permalink / raw)
  To: gdb-patches; +Cc: Aaron Merey

A corrupt debuginfo file can result in a null abbrev_info pointer
being passed to cooked_indexer::scan_attributes.  There is no check
for whether the abbrev pointer is null and SIGSEGV occurs when
attempting to dereference the pointer.

Fix this by calling throw_error at the beginning of scan_attributes
when the abbrev is nullptr.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31478
---
 gdb/dwarf2/read.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 4afb026b8ce..a6e5a3c856e 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -16077,6 +16077,9 @@ cooked_indexer::scan_attributes (dwarf2_per_cu_data *scanning_per_cu,
 				 bool *is_enum_class,
 				 bool for_specification)
 {
+  if (abbrev == nullptr)
+    throw_error (NOT_AVAILABLE_ERROR, _("Unable to find DWARF attributes."));
+
   bool origin_is_dwz = false;
   bool is_declaration = false;
   sect_offset origin_offset {};
-- 
2.43.0


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-03-14 17:52 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-13 20:18 [PATCH] gdb/dwarf2: Check for missing abbrev Aaron Merey
2024-03-14  1:39 ` Simon Marchi
2024-03-14 12:31   ` Tom Tromey
2024-03-14 13:56     ` Simon Marchi
2024-03-14 14:31       ` Tom Tromey
2024-03-14 17:45         ` Aaron Merey
2024-03-14 17:52           ` Simon Marchi
2024-03-14 12:29 ` Tom Tromey
2024-03-14 12:36 ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).