Message ID | 559AD8F7.4010708@gmail.com |
---|---|
State | New |
Headers | show |
On 07/06/2015 01:37 PM, Mikhail Maltsev wrote: > --- > 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. > # > This one is OK. jeff
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. #