From a07b293a9bd8049b58332a3df6f629cd81e3b225 Mon Sep 17 00:00:00 2001 From: s-hadinger <49731213+s-hadinger@users.noreply.github.com> Date: Wed, 27 Aug 2025 20:43:54 +0200 Subject: [PATCH] Berry remove overflow check when parsing hex (#23842) --- lib/libesp32/berry/src/be_strlib.c | 2 -- lib/libesp32/berry/tests/int.be | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/libesp32/berry/src/be_strlib.c b/lib/libesp32/berry/src/be_strlib.c index 81dc1b0e1..bc029ee4b 100644 --- a/lib/libesp32/berry/src/be_strlib.c +++ b/lib/libesp32/berry/src/be_strlib.c @@ -301,9 +301,7 @@ BERRY_API bint be_str2int(const char *str, const char **endstr) /* hex literal */ str += 2; /* skip 0x or 0X */ while ((c = be_char2hex(*str++)) >= 0) { - if (sum > M_IMAX / 16) goto overflow_pos; sum = sum * 16 + c; - if (sum < 0) goto overflow_pos; /* overflow check */ } if (endstr) { *endstr = str - 1; diff --git a/lib/libesp32/berry/tests/int.be b/lib/libesp32/berry/tests/int.be index 7c1853585..d11e2da62 100644 --- a/lib/libesp32/berry/tests/int.be +++ b/lib/libesp32/berry/tests/int.be @@ -12,3 +12,4 @@ assert(int("0x00") == 0) assert(int("0X1") == 1) assert(int("0x000000F") == 15) assert(int("0x1000") == 0x1000) +assert(int("0xFF00FF00") == 0xFF00FF00) \ No newline at end of file