summaryrefslogtreecommitdiff
path: root/libiberty/cp-demint.c
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2017-03-08 14:28:38 +0000
committerMarkus Trippelsdorf <trippels@gcc.gnu.org>2017-03-08 14:28:38 +0000
commita46586c34f32db516de3e5a2c61968015cfcd9d0 (patch)
tree1d24f195851c031e0d3f5a1d72300583d1befa25 /libiberty/cp-demint.c
parent121eb024c878d3b2474a3715d5250227af9613f7 (diff)
Fix PR demangler/70909 and 67264 (endless demangler recursion)
ChangeLog: PR demangler/70909 PR demangler/67264 * include/demangle.h: Add d_printing to struct demangle_component and pass struct demangle_component as non const. libiberty/ChangeLog: PR demangler/70909 PR demangler/67264 * cp-demangle.c: Fix endless recursion. Pass struct demangle_component as non const. (d_make_empty): Initialize variable. (d_print_comp_inner): Limit recursion. (d_print_comp): Decrement variable. * cp-demint.c (cplus_demangle_fill_component): Initialize variable. (cplus_demangle_fill_builtin_type): Likewise. (cplus_demangle_fill_operator): Likewise. * testsuite/demangle-expected: Add tests. From-SVN: r245978
Diffstat (limited to 'libiberty/cp-demint.c')
-rw-r--r--libiberty/cp-demint.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libiberty/cp-demint.c b/libiberty/cp-demint.c
index 64baffac8dd..13a71d96dec 100644
--- a/libiberty/cp-demint.c
+++ b/libiberty/cp-demint.c
@@ -123,6 +123,7 @@ cplus_demangle_fill_component (struct demangle_component *p,
p->type = type;
p->u.s_binary.left = left;
p->u.s_binary.right = right;
+ p->d_printing = 0;
return 1;
}
@@ -146,6 +147,7 @@ cplus_demangle_fill_builtin_type (struct demangle_component *p,
{
p->type = DEMANGLE_COMPONENT_BUILTIN_TYPE;
p->u.s_builtin.type = &cplus_demangle_builtin_types[i];
+ p->d_printing = 0;
return 1;
}
}
@@ -172,6 +174,7 @@ cplus_demangle_fill_operator (struct demangle_component *p,
{
p->type = DEMANGLE_COMPONENT_OPERATOR;
p->u.s_operator.op = &cplus_demangle_operators[i];
+ p->d_printing = 0;
return 1;
}
}