--- binutils.orig/libiberty/d-demangle.c 2022-11-30 14:25:36.976876338 +0000
+++ binutils-2.36.1/libiberty/d-demangle.c 2022-11-30 14:26:37.546690548 +0000
@@ -380,7 +380,7 @@ dlang_symbol_backref (string *decl, cons
/* Must point to a simple identifier. */
backref = dlang_number (backref, &len);
- if (backref == NULL)
+ if (backref == NULL || strlen (backref) < len)
return NULL;
backref = dlang_lname (decl, backref, len);