28 lines
948 B
Diff
28 lines
948 B
Diff
--- binutils.orig/binutils/debug.c 2024-11-06 17:39:57.452250912 +0000
|
|
+++ binutils-2.30/binutils/debug.c 2024-11-06 17:44:37.951018606 +0000
|
|
@@ -2483,8 +2483,22 @@ debug_write_type (struct debug_handle *i
|
|
case DEBUG_KIND_INDIRECT:
|
|
if (*type->u.kindirect->slot == DEBUG_TYPE_NULL)
|
|
return (*fns->empty_type) (fhandle);
|
|
- return debug_write_type (info, fns, fhandle, *type->u.kindirect->slot,
|
|
- name);
|
|
+ /* PR 28718: Allow for malicious recursion. */
|
|
+ {
|
|
+ static int recursion_depth = 0;
|
|
+ bfd_boolean result;
|
|
+
|
|
+ if (recursion_depth > 256)
|
|
+ {
|
|
+ debug_error (_("debug_write_type: too many levels of nested indirection"));
|
|
+ return FALSE;
|
|
+ }
|
|
+ ++ recursion_depth;
|
|
+ result = debug_write_type (info, fns, fhandle, *type->u.kindirect->slot,
|
|
+ name);
|
|
+ -- recursion_depth;
|
|
+ return result;
|
|
+ }
|
|
case DEBUG_KIND_VOID:
|
|
return (*fns->void_type) (fhandle);
|
|
case DEBUG_KIND_INT:
|