diff options
author | dj <dj@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-02-19 20:02:16 +0000 |
---|---|---|
committer | dj <dj@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-02-19 20:02:16 +0000 |
commit | 080f842c76c96e12a4b4171bad2de302ada9c602 (patch) | |
tree | 77b3e82a8f3bdacf1a50fa522f3943dcf4a85824 /libiberty/cplus-dem.c | |
parent | 268ae5e93e8ccf6551bdcac796919f22cdb07006 (diff) | |
download | gcc-080f842c76c96e12a4b4171bad2de302ada9c602.tar.gz |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@49875 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libiberty/cplus-dem.c')
-rw-r--r-- | libiberty/cplus-dem.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/libiberty/cplus-dem.c b/libiberty/cplus-dem.c index 710b69d9c7a..203e30dba24 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, ","); |