[Bug c++/67261] Demangler infinite recursion

2015-08-18 Thread miyuki at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67261

Mikhail Maltsev  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |DUPLICATE

--- Comment #2 from Mikhail Maltsev  ---
Oops. I should have checked it from the very beginning. The patch proposed for
PR61321 fixes this issue too. The result matches the expected demangling.

*** This bug has been marked as a duplicate of bug 61321 ***


[Bug c++/67261] Demangler infinite recursion

2015-08-18 Thread miyuki at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67261

Mikhail Maltsev  changed:

   What|Removed |Added

 CC||miyuki at gcc dot gnu.org

--- Comment #1 from Mikhail Maltsev  ---
I have more similar cases. When I did fuzz-testing I had several crashes caused
by infinite recursion. I did not find an easy and good solution to fix them.
Perhaps, introducing some additional logic which would specifically target
invalid input could help (like maintaining a hashtable/list/whatever of visited
nodes which cannot be visited again during normal result output; substitutions
would require some additional handling).
Nevertheless, I think that the testcases are still worth being recorded. Here
are some, I believe, distinct examples:

_Z1KIStcvT_E - i.e. something like:
template
K
Normally, when demangling templated conversion operator we would print out the
template parameter, but in this case this leads to infinite recursion, because
we think that the operator itself is the parameter.
More problems with conversion operator:
_ZcvT_IIS0_EE - in substitution
_ZcvT_IZcvT_E1fE - in local name
_Z1gINcvT_EE - in nested name (probably same as std::)
_ZcvT_ILZcvDTT_EEE - template parameter in decltype

Infinite recursion when collapsing ref-qualifiers:
_Z1gIJOOT_EEOT_c

Memory hog with pointers-to-member and arrays:
_Z1KMMMA_xooo
(output size doubles with each M-o pair)
"pointer-to-member" and "array" are not necessarily consecutive:
_ZdvMA_DTdvfp_fp_Eededilfdfdfdfd