diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2017-04-27 10:44:28 +0100 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2017-04-27 10:44:28 +0100 |
commit | de3b531c9aa93592f98ebd99c6b35be632e3c1b3 (patch) | |
tree | 663a245b3b7b8a12f360f4e61851e6af2521dfde /libiberty/cp-demangle.c | |
parent | e77e24291b85bcb1ae1c7c48d8194a66ba642974 (diff) | |
download | gcc-de3b531c9aa93592f98ebd99c6b35be632e3c1b3.tar.gz |
PR demangler/80513 check for overflows and invalid characters in thunks
PR demangler/80513
* cp-demangle.c (d_number): Check for overflow.
* cplus-dem.c (consume_count): Fix overflow check.
(gnu_special): Check for underscore after thunk delta.
* testsuite/demangle-expected: Add tests for overflows and invalid
characters in thunks.
From-SVN: r247300
Diffstat (limited to 'libiberty/cp-demangle.c')
-rw-r--r-- | libiberty/cp-demangle.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c index e1db9005e15..7b8d0b4cbaa 100644 --- a/libiberty/cp-demangle.c +++ b/libiberty/cp-demangle.c @@ -1692,6 +1692,8 @@ d_number (struct d_info *di) ret = - ret; return ret; } + if (ret > ((INT_MAX - (peek - '0')) / 10)) + return -1; ret = ret * 10 + peek - '0'; d_advance (di, 1); peek = d_peek_char (di); |