[PATCH] objdump: avoid possible SIGSEGV when printing debug info [BZ #32829]

Collin Funk collin.funk1@gmail.com
Mon Mar 31 04:29:31 GMT 2025


* binutils/debug.c (debug_type_samep): Check for enum types where names
and values cannot be found.
---
 binutils/debug.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/binutils/debug.c b/binutils/debug.c
index dcc8ccde4c5..83fe5f59f8d 100644
--- a/binutils/debug.c
+++ b/binutils/debug.c
@@ -3101,6 +3101,11 @@ debug_type_samep (struct debug_handle *info, struct debug_type_s *t1,
 	ret = t2->u.kenum == NULL;
       else if (t2->u.kenum == NULL)
 	ret = false;
+      else if (t1->u.kenum->names == NULL)
+	ret = t2->u.kenum->names == NULL
+	  && t1->u.kenum->values == t2->u.kenum->values;
+      else if (t2->u.kenum->names == NULL)
+	ret = false;
       else
 	{
 	  const char **pn1, **pn2;
-- 
2.49.0



More information about the Binutils mailing list