diff options
author | Geoffrey Keating <geoffk@apple.com> | 2007-03-16 01:07:52 +0000 |
---|---|---|
committer | Geoffrey Keating <geoffk@gcc.gnu.org> | 2007-03-16 01:07:52 +0000 |
commit | 771904f1e6e8ca6092d7d96553791b47eba6c71a (patch) | |
tree | 36dda64d30068c584b2a3efbdad5b5d9fefa6696 | |
parent | ba502ad6bec253a702ad177c6257aab4a8c1102f (diff) | |
download | gcc-771904f1e6e8ca6092d7d96553791b47eba6c71a.zip gcc-771904f1e6e8ca6092d7d96553791b47eba6c71a.tar.gz gcc-771904f1e6e8ca6092d7d96553791b47eba6c71a.tar.bz2 |
cp-demangle.c (d_encoding): Exit early on error.
* cp-demangle.c (d_encoding): Exit early on error.
(d_pointer_to_member_type): Exit early if cplus_demangle_type
returns NULL.
(cplus_demangle_type): Likewise.
* testsuite/demangle-expected: New testcase.
From-SVN: r122972
-rw-r--r-- | libiberty/ChangeLog | 8 | ||||
-rw-r--r-- | libiberty/cp-demangle.c | 6 | ||||
-rw-r--r-- | libiberty/testsuite/demangle-expected | 4 |
3 files changed, 16 insertions, 2 deletions
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index 6ac77d7..5c2f527 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,11 @@ +2007-03-15 Geoffrey Keating <geoffk@apple.com> + + * cp-demangle.c (d_encoding): Exit early on error. + (d_pointer_to_member_type): Exit early if cplus_demangle_type + returns NULL. + (cplus_demangle_type): Likewise. + * testsuite/demangle-expected: New testcase. + 2007-03-01 Brooks Moses <brooks.moses@codesourcery.com> * Makefile.in: Add install-pdf target as copied from diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c index 1e775d9..5c930c6 100644 --- a/libiberty/cp-demangle.c +++ b/libiberty/cp-demangle.c @@ -1067,7 +1067,7 @@ d_encoding (struct d_info *di, int top_level) } peek = d_peek_char (di); - if (peek == '\0' || peek == 'E') + if (dc == NULL || peek == '\0' || peek == 'E') return dc; return d_make_comp (di, DEMANGLE_COMPONENT_TYPED_NAME, dc, d_bare_function_type (di, has_return_type (dc))); @@ -1780,7 +1780,7 @@ cplus_demangle_type (struct d_info *di) if (pret == NULL) return NULL; *pret = cplus_demangle_type (di); - if (! d_add_substitution (di, ret)) + if (! *pret || ! d_add_substitution (di, ret)) return NULL; return ret; } @@ -2135,6 +2135,8 @@ d_pointer_to_member_type (struct d_info *di) if (pmem == NULL) return NULL; *pmem = cplus_demangle_type (di); + if (*pmem == NULL) + return NULL; if (pmem != &mem && (*pmem)->type != DEMANGLE_COMPONENT_FUNCTION_TYPE) { diff --git a/libiberty/testsuite/demangle-expected b/libiberty/testsuite/demangle-expected index 56d9f89..471819e 100644 --- a/libiberty/testsuite/demangle-expected +++ b/libiberty/testsuite/demangle-expected @@ -3838,3 +3838,7 @@ _ZNSA --format=gnu-v3 _ZNT _ZNT +# Dereferencing NULL in d_pointer_to_member_type +--format=gnu-v3 +_Z1aMark +_Z1aMark |