From 13b6ef76dc275232310ebfca27db08aeef9b858c Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Fri, 21 Apr 2017 09:01:56 +0000 Subject: libiberty: Always return NULL if d_add_substitution fails. d_add_substitution can fail for various reasons, like when the subs array is full. If d_add_substitution fails d_substitution should return NULL early and not try to continue. Every other call of d_add_substitution is handled in the same way. libiberty/ChangeLog: * cp-demangle.c (d_substitution): Return NULL if d_add_substitution fails. From-SVN: r247055 --- libiberty/cp-demangle.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'libiberty/cp-demangle.c') diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c index 2c7d5c5faab..aeff7a79d74 100644 --- a/libiberty/cp-demangle.c +++ b/libiberty/cp-demangle.c @@ -3891,7 +3891,8 @@ d_substitution (struct d_info *di, int prefix) /* If there are ABI tags on the abbreviation, it becomes a substitution candidate. */ dc = d_abi_tags (di, dc); - d_add_substitution (di, dc); + if (! d_add_substitution (di, dc)) + return NULL; } return dc; } -- cgit v1.2.1