From 1c40e11956eff80fd9ec305206ea5aaf73ce4fd9 Mon Sep 17 00:00:00 2001 From: Paul Pluzhnikov Date: Tue, 29 Oct 2019 08:29:59 -0700 Subject: [PATCH] cp-demangle.c (d_number): Avoid signed int overflow. 2019-10-29 Paul Pluzhnikov * cp-demangle.c (d_number): Avoid signed int overflow. From-SVN: r277575 --- libiberty/ChangeLog | 4 ++++ libiberty/cp-demangle.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index bba2be8b81b..4992b15d681 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,7 @@ +2019-10-29 Paul Pluzhnikov + + * cp-demangle.c (d_number): Avoid signed int overflow. + 2019-10-28 Miguel Saldivar * cp-demangle.c (d_print_mod): Add a space before printing `complex` diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c index 877ad359be1..5b674d7d93c 100644 --- a/libiberty/cp-demangle.c +++ b/libiberty/cp-demangle.c @@ -1717,7 +1717,7 @@ d_number (struct d_info *di) } if (ret > ((INT_MAX - (peek - '0')) / 10)) return -1; - ret = ret * 10 + peek - '0'; + ret = ret * 10 + (peek - '0'); d_advance (di, 1); peek = d_peek_char (di); } -- 2.30.2