Skip to content

Commit 7ac9578

Browse files
committed
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1: Fix unspecified behaviour in zend_alloc in heap->limit computation
2 parents 882cc4f + 28110f8 commit 7ac9578

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
@@ -1934,7 +1934,7 @@ static zend_mm_heap *zend_mm_init(void)
19341934
heap->peak = 0;
19351935
#endif
19361936
#if ZEND_MM_LIMIT
1937-
heap->limit = ((size_t)Z_L(-1) >> (size_t)Z_L(1));
1937+
heap->limit = (size_t)Z_L(-1) >> 1;
19381938
heap->overflow = 0;
19391939
#endif
19401940
#if ZEND_MM_CUSTOM
@@ -2898,7 +2898,7 @@ static void alloc_globals_ctor(zend_alloc_globals *alloc_globals)
28982898
zend_mm_heap *mm_heap = alloc_globals->mm_heap = malloc(sizeof(zend_mm_heap));
28992899
memset(mm_heap, 0, sizeof(zend_mm_heap));
29002900
mm_heap->use_custom_heap = ZEND_MM_CUSTOM_HEAP_STD;
2901-
mm_heap->limit = ((size_t)Z_L(-1) >> (size_t)Z_L(1));
2901+
mm_heap->limit = (size_t)Z_L(-1) >> 1;
29022902
mm_heap->overflow = 0;
29032903

29042904
if (!tracked) {
@@ -3087,7 +3087,7 @@ ZEND_API zend_mm_heap *zend_mm_startup_ex(const zend_mm_handlers *handlers, void
30873087
heap->peak = 0;
30883088
#endif
30893089
#if ZEND_MM_LIMIT
3090-
heap->limit = (Z_L(-1) >> Z_L(1));
3090+
heap->limit = (size_t)Z_L(-1) >> 1;
30913091
heap->overflow = 0;
30923092
#endif
30933093
#if ZEND_MM_CUSTOM

0 commit comments

Comments
 (0)