aboutsummaryrefslogtreecommitdiff
path: root/gdb/cplus-dem.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/cplus-dem.c')
-rw-r--r--gdb/cplus-dem.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/gdb/cplus-dem.c b/gdb/cplus-dem.c
index 911e1b2..f3b3d88 100644
--- a/gdb/cplus-dem.c
+++ b/gdb/cplus-dem.c
@@ -1578,7 +1578,9 @@ demangle_args (declp, type, work)
#ifdef ARM_DEMANGLING
t--;
#endif
- if (t >= work -> ntypes)
+ /* Validate the type index. Protect against illegal indices from
+ malformed type strings. */
+ if ((t < 0) || (t >= work -> ntypes))
{
return (0);
}