Skip to content

Commit 8759ad6

Browse files
committed
Remote heap spraying / feng shui protection
Isolate request environment / input in separate chunks to makes it more difficult to remotely control the layout of the heap.
1 parent e844e68 commit 8759ad6

File tree

18 files changed

+351
-163
lines changed

18 files changed

+351
-163
lines changed

Zend/tests/bug70258.phpt

Lines changed: 2 additions & 2 deletions
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
if (PHP_OS_FAMILY === 'Windows') {
@@ -28,4 +28,4 @@ $a = new A;
2828
$a->core();
2929
?>
3030
--EXPECTF--
31-
Fatal error: Allowed memory size of 2097152 bytes exhausted%s(tried to allocate %d bytes) in %s on line %d
31+
Fatal error: Allowed memory size of 4194304 bytes exhausted%s(tried to allocate %d bytes) in %s on line %d

Zend/tests/closures/gh12073.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function test() {
1919
};
2020
}
2121

22-
ini_set('memory_limit', '2M');
22+
ini_set('memory_limit', '4M');
2323

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

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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ if (PHP_OS_FAMILY === 'Windows') {
88
if (getenv("USE_ZEND_ALLOC") === "0") die("skip ZMM is disabled");
99
?>
1010
--INI--
11-
memory_limit=2M
11+
memory_limit=4M
1212
--FILE--
1313
<?php
1414

Zend/tests/gh11189_1.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ if (PHP_OS_FAMILY === 'Windows') {
88
if (getenv("USE_ZEND_ALLOC") === "0") die("skip ZMM is disabled");
99
?>
1010
--INI--
11-
memory_limit=2M
11+
memory_limit=4M
1212
--FILE--
1313
<?php
1414

Zend/tests/new_oom.inc

Lines changed: 1 addition & 1 deletion
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

Lines changed: 2 additions & 2 deletions
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)