diff options
author | Keith Seitz <keiths@redhat.com> | 2019-04-25 13:05:51 -0700 |
---|---|---|
committer | Keith Seitz <keiths@redhat.com> | 2019-04-25 13:06:52 -0700 |
commit | 725cbb63263d27e87f5a4f9b73281e7710de53e4 (patch) | |
tree | 60962bd09743ddf401e082ceee91b5688d319a61 /bfd | |
parent | 3d1cbb78936fbf2985ffd2ebf074841599ead788 (diff) | |
download | fsf-binutils-gdb-725cbb63263d27e87f5a4f9b73281e7710de53e4.zip fsf-binutils-gdb-725cbb63263d27e87f5a4f9b73281e7710de53e4.tar.gz fsf-binutils-gdb-725cbb63263d27e87f5a4f9b73281e7710de53e4.tar.bz2 |
c++/24367: Infinite recursion of typedef substitution
This bug finds another usage where we end up segfaulting while
normalizing user input. inspect_type and replace_type recurse,
attempting to substitute the "real" symbol name for the typedef name.
However, since the both these names are the same, they keep calling
each other until the stack overflows.
A simple reproducer for it is given by
typedef struct foo foo;
int qux (foo *f) { return 0; }
(gdb) b qux(foo*)
Segmentation fault
inspect_type already contains some special handling to prevent a
similar situation from occurring with namespaces. I wonder, however,
whether we need be so pedantic about the exact nature of the substitution.
This patch implements this rather more aggressive assumption that these
substitutions should be avoided whenever the replacement symbol's name is
exactly the same as the one we're trying to substitute. [In the above
example, we're trying to substitute the tyepdef named "foo" with the symbol
named "foo" (a struct).]
gdb/ChangeLog:
PR c++/24367
* cp-support.c (inspect_type): Don't attempt substitutions
of symbol with the same name.
gdb/testsuite/ChangeLog:
PR c++/24367
* gdb.cp/meth-typedefs.cc (incomplete_struct)
(another_incomplete_struct, test_incomplete): New definitions.
(main): Use new definitions.
* gdb.cp/meth-typedefs.exp: Add new tests for `test_incomplete'
functions.
Diffstat (limited to 'bfd')
0 files changed, 0 insertions, 0 deletions