This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PATCH COMMITTED: PR 29176: Add overflow check to demangler
- From: Ian Lance Taylor <ian at airs dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: 22 Sep 2006 06:53:54 -0700
- Subject: PATCH COMMITTED: PR 29176: Add overflow check to demangler
This patch checks for overflow when computing the substitution index
in the demangler. This fixes a core dump reported in PR 29176.
Tested on i686-pc-linux-gnu. Committed to mainline.
Ian
2006-09-22 Ian Lance Taylor <ian@airs.com>
PR other/29176
* cp-demangle.c (d_substitution): Check for overflow when
computing substitution index.
Index: cp-demangle.c
===================================================================
--- cp-demangle.c (revision 117143)
+++ cp-demangle.c (working copy)
@@ -2505,6 +2505,8 @@ d_substitution (struct d_info *di, int p
id = id * 36 + c - 'A' + 10;
else
return NULL;
+ if (id < 0)
+ return NULL;
c = d_next_char (di);
}
while (c != '_');
Index: testsuite/demangle-expected
===================================================================
--- testsuite/demangle-expected (revision 117143)
+++ testsuite/demangle-expected (working copy)
@@ -3811,3 +3811,8 @@ make<Factory, int>
_Z1fM1AKiPKS1_
f(int const A::*, int const A::* const*)
f
+# This used to cause a core dump in the demangler -- PR 29176
+--format=auto --no-params
+SASDASDFASDF_sdfsdf
+SASDASDFASDF_sdfsdf
+SASDASDFASDF_sdfsdf