Skip to content

Commit 600da8c

Browse files
committed
Merge branch 'PHP-8.4'
2 parents 93c9c7c + 7477c1b commit 600da8c

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

Zend/zend_strtod.c

+11-4
Original file line numberDiff line numberDiff line change
@@ -3605,13 +3605,20 @@ rv_alloc(i) int i;
36053605
rv_alloc(int i)
36063606
#endif
36073607
{
3608-
int k, *r;
36093608

3610-
size_t j = sizeof(ULong);
3609+
int j, k, *r;
3610+
size_t rem;
3611+
3612+
rem = sizeof(Bigint) - sizeof(ULong) - sizeof(int);
3613+
3614+
3615+
j = sizeof(ULong);
3616+
if (i > ((INT_MAX >> 2) + rem))
3617+
zend_error_noreturn(E_ERROR, "rv_alloc() allocation overflow %d", i);
36113618
for(k = 0;
3612-
sizeof(Bigint) - sizeof(ULong) - sizeof(int) + j <= (size_t)i;
3613-
j <<= 1)
3619+
rem + j <= (size_t)i; j <<= 1)
36143620
k++;
3621+
36153622
r = (int*)Balloc(k);
36163623
*r = k;
36173624
return

0 commit comments

Comments
 (0)