Skip to content

Commit 0d05928

Browse files
committed
Remote heap spraying / feng chui protection
Isolate request environment / input in separate chunks to makes it more difficult to remotely control the layout of the heap.
1 parent 38f7290 commit 0d05928

17 files changed

+347
-161
lines changed

Zend/tests/bug70258.phpt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
--TEST--
22
Bug #70258 (Segfault if do_resize fails to allocated memory)
33
--INI--
4-
memory_limit=2M
4+
memory_limit=4M
55
--SKIPIF--
66
<?php
77
$zend_mm_enabled = getenv("USE_ZEND_ALLOC");
@@ -25,4 +25,4 @@ $a = new A;
2525
$a->core();
2626
?>
2727
--EXPECTF--
28-
Fatal error: Allowed memory size of 2097152 bytes exhausted%s(tried to allocate %d bytes) in %s on line %d
28+
Fatal error: Allowed memory size of 4194304 bytes exhausted%s(tried to allocate %d bytes) in %s on line %d

Zend/tests/fibers/out-of-memory-in-fiber.phpt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
--TEST--
22
Out of Memory in a fiber
33
--INI--
4-
memory_limit=2M
4+
memory_limit=4M
55
--SKIPIF--
66
<?php
77
if (getenv("USE_ZEND_ALLOC") === "0") {

Zend/tests/fibers/out-of-memory-in-nested-fiber.phpt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
--TEST--
22
Out of Memory in a nested fiber
33
--INI--
4-
memory_limit=2M
4+
memory_limit=4M
55
--SKIPIF--
66
<?php
77
if (getenv("USE_ZEND_ALLOC") === "0") {

Zend/tests/fibers/out-of-memory-in-recursive-fiber.phpt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
--TEST--
22
Out of Memory from recursive fiber creation
33
--INI--
4-
memory_limit=2M
4+
memory_limit=4M
55
--SKIPIF--
66
<?php
77
if (getenv("USE_ZEND_ALLOC") === "0") {

Zend/tests/gh11189.phpt

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ GH-11189: Exceeding memory limit in zend_hash_do_resize leaves the array in an i
55
if (getenv("USE_ZEND_ALLOC") === "0") die("skip ZMM is disabled");
66
?>
77
--INI--
8-
memory_limit=2M
8+
memory_limit=4M
99
--FILE--
1010
<?php
1111

Zend/tests/gh11189_1.phpt

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ GH-11189: Exceeding memory limit in zend_hash_do_resize leaves the array in an i
55
if (getenv("USE_ZEND_ALLOC") === "0") die("skip ZMM is disabled");
66
?>
77
--INI--
8-
memory_limit=2M
8+
memory_limit=4M
99
--FILE--
1010
<?php
1111

Zend/tests/gh12073.phpt

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ function test() {
1616
};
1717
}
1818

19-
ini_set('memory_limit', '2M');
19+
ini_set('memory_limit', '4M');
2020

2121
$array = [];
2222
for ($i = 0; $i < 10_000; $i++) {

Zend/tests/new_oom.inc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
$mb_used = (int) ceil(memory_get_usage() / (1024 ** 2));
3+
$mb_used = (int) ceil(memory_get_usage(true) / (1024 ** 2));
44
ini_set('memory_limit', ($mb_used + 1) . 'M');
55

66
$class = $argv[1];

Zend/tests/object_gc_in_shutdown.phpt

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
Bug object gc not working in shutdown
33
--FILE--
44
<?php
5-
ini_set('memory_limit', '2M');
5+
ini_set('memory_limit', '4M');
66
register_shutdown_function(function () {
7-
for ($n = 1000 * 1000; $n--;) {
7+
for ($n = 2 * 1000 * 1000; $n--;) {
88
new stdClass;
99
}
1010
echo "OK\n";

0 commit comments

Comments
 (0)