Skip to content

Commit 29a66c3

Browse files
committed
Fix phpGH-9361: Segmentation fault on script exit
Using a lot of memory may overflow some `int` calculations; to avoid that we make sure that the operands are promoted to `size_t`. This issue has been analyzed by @chschneider.
1 parent d6831e9 commit 29a66c3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Zend/zend_alloc_sizes.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#ifndef ZEND_ALLOC_SIZES_H
2020
#define ZEND_ALLOC_SIZES_H
2121

22-
#define ZEND_MM_CHUNK_SIZE (2 * 1024 * 1024) /* 2 MB */
22+
#define ZEND_MM_CHUNK_SIZE ((size_t) (2 * 1024 * 1024)) /* 2 MB */
2323
#define ZEND_MM_PAGE_SIZE (4 * 1024) /* 4 KB */
2424
#define ZEND_MM_PAGES (ZEND_MM_CHUNK_SIZE / ZEND_MM_PAGE_SIZE) /* 512 */
2525
#define ZEND_MM_FIRST_PAGE (1)

0 commit comments

Comments
 (0)