aboutsummaryrefslogtreecommitdiff
path: root/libiberty/cplus-dem.c
diff options
context:
space:
mode:
authorScott Snyder <snyder@fnal.gov>2002-02-19 20:02:16 +0000
committerDJ Delorie <dj@gcc.gnu.org>2002-02-19 15:02:16 -0500
commitb1c1a22fb269af88df292d3770595215206f947f (patch)
tree77b3e82a8f3bdacf1a50fa522f3943dcf4a85824 /libiberty/cplus-dem.c
parent6d1def5c667f516b4e7c0d8445c7598fb060e88f (diff)
downloadgcc-b1c1a22fb269af88df292d3770595215206f947f.zip
gcc-b1c1a22fb269af88df292d3770595215206f947f.tar.gz
gcc-b1c1a22fb269af88df292d3770595215206f947f.tar.bz2
demangle-expected: Add test case for infinite loop in demangler.
* testsuite/demangle-expected: Add test case for infinite loop in demangler. * cplus-dem.c (demangle_arm_hp_template): Stop trying to demangle if do_type() doesn't make any progress --- prevents an infinite loop. From-SVN: r49875
Diffstat (limited to 'libiberty/cplus-dem.c')
-rw-r--r--libiberty/cplus-dem.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/libiberty/cplus-dem.c b/libiberty/cplus-dem.c
index 710b69d..203e30d 100644
--- a/libiberty/cplus-dem.c
+++ b/libiberty/cplus-dem.c
@@ -2414,8 +2414,15 @@ demangle_arm_hp_template (work, mangled, n, declp)
break;
default:
/* Not handling other HP cfront stuff */
- if (!do_type (work, &args, &arg))
- goto cfront_template_args_done;
+ {
+ const char* old_args = args;
+ if (!do_type (work, &args, &arg))
+ goto cfront_template_args_done;
+
+ /* Fail if we didn't make any progress: prevent infinite loop. */
+ if (args == old_args)
+ return;
+ }
}
string_appends (declp, &arg);
string_append (declp, ",");