Skip to content

Commit 6537811

Browse files
committed
Merge branch 'PHP-8.3'
* PHP-8.3: Fix unspecified behaviour in zend_alloc in heap->limit computation
2 parents 92e4e8b + 85cb081 commit 6537811

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Zend/zend_alloc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1933,7 +1933,7 @@ static zend_mm_heap *zend_mm_init(void)
19331933
heap->peak = 0;
19341934
#endif
19351935
#if ZEND_MM_LIMIT
1936-
heap->limit = ((size_t)Z_L(-1) >> (size_t)Z_L(1));
1936+
heap->limit = (size_t)Z_L(-1) >> 1;
19371937
heap->overflow = 0;
19381938
#endif
19391939
#if ZEND_MM_CUSTOM
@@ -2907,7 +2907,7 @@ static void alloc_globals_ctor(zend_alloc_globals *alloc_globals)
29072907
zend_mm_heap *mm_heap = alloc_globals->mm_heap = malloc(sizeof(zend_mm_heap));
29082908
memset(mm_heap, 0, sizeof(zend_mm_heap));
29092909
mm_heap->use_custom_heap = ZEND_MM_CUSTOM_HEAP_STD;
2910-
mm_heap->limit = ((size_t)Z_L(-1) >> (size_t)Z_L(1));
2910+
mm_heap->limit = (size_t)Z_L(-1) >> 1;
29112911
mm_heap->overflow = 0;
29122912

29132913
if (!tracked) {
@@ -3096,7 +3096,7 @@ ZEND_API zend_mm_heap *zend_mm_startup_ex(const zend_mm_handlers *handlers, void
30963096
heap->peak = 0;
30973097
#endif
30983098
#if ZEND_MM_LIMIT
3099-
heap->limit = (Z_L(-1) >> Z_L(1));
3099+
heap->limit = (size_t)Z_L(-1) >> 1;
31003100
heap->overflow = 0;
31013101
#endif
31023102
#if ZEND_MM_CUSTOM

0 commit comments

Comments
 (0)