Berry remove overflow check when parsing hex (#23842)
This commit is contained in:
parent
5d9e62eebe
commit
a07b293a9b
@ -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;
|
||||
|
||||
@ -12,3 +12,4 @@ assert(int("0x00") == 0)
|
||||
assert(int("0X1") == 1)
|
||||
assert(int("0x000000F") == 15)
|
||||
assert(int("0x1000") == 0x1000)
|
||||
assert(int("0xFF00FF00") == 0xFF00FF00)
|
||||
Loading…
Reference in New Issue
Block a user