diff options
author | DJ Delorie <dj@delorie.com> | 2002-02-19 21:01:40 +0000 |
---|---|---|
committer | DJ Delorie <dj@delorie.com> | 2002-02-19 21:01:40 +0000 |
commit | 94c28f3eeb4461c0a9d98dac53ad3f442ed3a162 (patch) | |
tree | a96330f5390b9eaf0d20d978f3f56ca8c1862157 /libiberty | |
parent | 2631be3d28779b6ca027270933e3f6454b3f898c (diff) | |
download | gdb-94c28f3eeb4461c0a9d98dac53ad3f442ed3a162.tar.gz |
merge from gcc
Diffstat (limited to 'libiberty')
-rw-r--r-- | libiberty/ChangeLog | 8 | ||||
-rw-r--r-- | libiberty/cplus-dem.c | 11 | ||||
-rw-r--r-- | libiberty/testsuite/demangle-expected | 6 |
3 files changed, 23 insertions, 2 deletions
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index f3ef42903ca..9c0fe09dcac 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,11 @@ +2002-02-19 Scott Snyder <snyder@fnal.gov> + + * 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. + 2002-02-18 Carlo Wood <carlo@gnu.org> PR c++/5390 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, ","); diff --git a/libiberty/testsuite/demangle-expected b/libiberty/testsuite/demangle-expected index 3e90d9f1eaa..81b061d5b28 100644 --- a/libiberty/testsuite/demangle-expected +++ b/libiberty/testsuite/demangle-expected @@ -2594,3 +2594,9 @@ _Utf58_0_1__1_2147483647__2147483648 --format=gnu-v3 St9bad_alloc std::bad_alloc +# +# This caused an infinite loop. +# We still don't demangle this correctly, but at least we don't hang. +--format=auto +__CPR212____ct__Q3_3std141list__tm__128_Q2_3edm41THandle__tm__26_Q2_4emid15EMparticleChunkQ2_3std68allocator__tm__51_Q2_3edmJ37J14const_iteratorFRCQ3_3std18list__tm__7_Z1ZZ2Z8iterator +_Z1ZZ2Z::__CPR212____ct__Q3_3std141list__tm__128_Q2_3edm41THandle__tm__26_Q2_4emid15EMparticleChunkQ2_3std68allocator__tm__51_Q2_3edmJ37J14const_iteratorFRCQ3_3std18list__tm(iterator) |