This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH 5/7] Fix braced-init-list demangling
- From: Mikhail Maltsev <maltsevm at gmail dot com>
- To: gcc-patches <gcc-patches at gnu dot org>, Jason Merrill <jason at redhat dot com>
- Date: Mon, 06 Jul 2015 22:37:27 +0300
- Subject: [PATCH 5/7] Fix braced-init-list demangling
- Authentication-results: sourceware.org; auth=none
- References: <559AD66D dot 1070809 at gmail dot com>
---
libiberty/cp-demangle.c | 2 ++
libiberty/testsuite/demangle-expected | 4 ++++
2 files changed, 6 insertions(+)
diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c
index befa6b6..424b1c5 100644
--- a/libiberty/cp-demangle.c
+++ b/libiberty/cp-demangle.c
@@ -3167,6 +3167,8 @@ d_expression_1 (struct d_info *di)
struct demangle_component *type = NULL;
if (peek == 't')
type = cplus_demangle_type (di);
+ if (!d_peek_next_char (di))
+ return NULL;
d_advance (di, 2);
return d_make_comp (di, DEMANGLE_COMPONENT_INITIALIZER_LIST,
type, d_exprlist (di, 'E'));
diff --git a/libiberty/testsuite/demangle-expected
b/libiberty/testsuite/demangle-expected
index 9a8d3db..2dbab14 100644
--- a/libiberty/testsuite/demangle-expected
+++ b/libiberty/testsuite/demangle-expected
@@ -4100,6 +4100,10 @@ Av32_f
--format=gnu-v3
_Z11111111111
_Z11111111111
+# Check out-of-bounds access when decoding braced initializer list
+--format=gnu-v3
+_ZDTtl
+_ZDTtl
#
# Ada (GNAT) tests.
#
--
1.8.3.1