https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70498
--- Comment #3 from Bernd Schmidt <bernds at gcc dot gnu.org> --- Author: bernds Date: Mon May 2 17:06:40 2016 New Revision: 235767 URL: https://gcc.gnu.org/viewcvs?rev=235767&root=gcc&view=rev Log: Demangler integer overflow fixes from Marcel Böhme. PR c++/70498 * cp-demangle.c: Parse numbers as integer instead of long to avoid overflow after sanity checks. Include <limits.h> if available. (INT_MAX): Define if necessary. (d_make_template_param): Takes integer argument instead of long. (d_make_function_param): Likewise. (d_append_num): Likewise. (d_identifier): Likewise. (d_number): Parse as and return integer. (d_compact_number): Handle overflow. (d_source_name): Change variable type to integer for parsed number. (d_java_resource): Likewise. (d_special_name): Likewise. (d_discriminator): Likewise. (d_unnamed_type): Likewise. * testsuite/demangle-expected: Add regression test cases. Modified: trunk/libiberty/ChangeLog trunk/libiberty/cp-demangle.c trunk/libiberty/testsuite/demangle-expected