]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - libiberty/cp-demangle.c
re PR other/22268 (libiberty demanger crashes on (invalid) mangled name)
[thirdparty/gcc.git] / libiberty / cp-demangle.c
index 61744390725ef1201ff3b58f5da166bb3976a2c7..8f1cfb17f87f2734e0b756390eeaa94a69dc87ab 100644 (file)
@@ -2337,7 +2337,11 @@ d_expr_primary (struct d_info *di)
        }
       s = d_str (di);
       while (d_peek_char (di) != 'E')
-       d_advance (di, 1);
+       {
+         if (d_peek_char (di) == '\0')
+           return NULL;
+         d_advance (di, 1);
+       }
       ret = d_make_comp (di, t, type, d_make_name (di, s, d_str (di) - s));
     }
   if (d_next_char (di) != 'E')