File tree Expand file tree Collapse file tree 2 files changed +34
-1
lines changed Expand file tree Collapse file tree 2 files changed +34
-1
lines changed Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Bug #55509 (segfault on x86_64 using more than 2G memory)
3
+ --SKIPIF--
4
+ <?php
5
+ if (PHP_INT_SIZE == 4 ) {
6
+ die ('skip Not for 32-bits OS ' );
7
+ }
8
+ ?>
9
+ --INI--
10
+ memory_limit=3G
11
+ --FILE--
12
+ <?php
13
+ $ a1 = str_repeat ("1 " , 1024 * 1024 * 1024 * 0.5 );
14
+ echo "1 \n" ;
15
+ $ a2 = str_repeat ("2 " , 1024 * 1024 * 1024 * 0.5 );
16
+ echo "2 \n" ;
17
+ $ a3 = str_repeat ("3 " , 1024 * 1024 * 1024 * 0.5 );
18
+ echo "3 \n" ;
19
+ $ a4 = str_repeat ("4 " , 1024 * 1024 * 1024 * 0.5 );
20
+ echo "4 \n" ;
21
+ $ a5 = str_repeat ("5 " , 1024 * 1024 * 1024 * 0.5 );
22
+ echo "5 \n" ;
23
+ $ a6 = str_repeat ("6 " , 1024 * 1024 * 1024 * 0.5 );
24
+ echo "6 \n" ;
25
+ ?>
26
+ --EXPECTF--
27
+ 1
28
+ 2
29
+ 3
30
+ 4
31
+ 5
32
+
33
+ Fatal error: Allowed memory size of %d bytes exhausted (tried to allocate %d bytes) in %s/bug55509.php on line %d
Original file line number Diff line number Diff line change @@ -515,7 +515,7 @@ static unsigned int _zend_mm_cookie = 0;
515
515
#define ZEND_MM_IS_GUARD_BLOCK (b ) (((b)->info._size & ZEND_MM_TYPE_MASK) == ZEND_MM_GUARD_BLOCK)
516
516
517
517
#define ZEND_MM_NEXT_BLOCK (b ) ZEND_MM_BLOCK_AT(b, ZEND_MM_BLOCK_SIZE(b))
518
- #define ZEND_MM_PREV_BLOCK (b ) ZEND_MM_BLOCK_AT(b, -(int )((b)->info._prev & ~ZEND_MM_TYPE_MASK))
518
+ #define ZEND_MM_PREV_BLOCK (b ) ZEND_MM_BLOCK_AT(b, -(ssize_t )((b)->info._prev & ~ZEND_MM_TYPE_MASK))
519
519
520
520
#define ZEND_MM_PREV_BLOCK_IS_FREE (b ) (!((b)->info._prev & ZEND_MM_USED_BLOCK))
521
521
You can’t perform that action at this time.
0 commit comments