From 3e77c15105551dee21edac0ab090ffaf10c4ff4d Mon Sep 17 00:00:00 2001 From: Ben Fuhrmannek Date: Thu, 3 Mar 2016 15:36:40 +0100 Subject: memory limit --- tests/executor/memory_limit.phpt | 29 ++++++++++++++++ tests/executor/memory_limit_64bit.phpt | 43 ++++++++++++++++++++++++ tests/executor/memory_limit_64bit_10G.phpt | 36 ++++++++++++++++++++ tests/executor/memory_limit_negative.phpt | 18 ++++++++++ tests/executor/memory_limit_other_hardlimit.phpt | 28 +++++++++++++++ 5 files changed, 154 insertions(+) create mode 100644 tests/executor/memory_limit.phpt create mode 100644 tests/executor/memory_limit_64bit.phpt create mode 100644 tests/executor/memory_limit_64bit_10G.phpt create mode 100644 tests/executor/memory_limit_negative.phpt create mode 100644 tests/executor/memory_limit_other_hardlimit.phpt (limited to 'tests') diff --git a/tests/executor/memory_limit.phpt b/tests/executor/memory_limit.phpt new file mode 100644 index 0000000..404ab19 --- /dev/null +++ b/tests/executor/memory_limit.phpt @@ -0,0 +1,29 @@ +--TEST-- +memory_limit test: set suhosin hard_limit to normal limit +--SKIPIF-- + +--INI-- +memory_limit=16M +suhosin.memory_limit=0 +suhosin.log.syslog=0 +suhosin.log.script=0 +suhosin.log.sapi=2 +--FILE-- + +--EXPECTF-- +13M +14M +15M +16M +ALERT - script tried to increase memory_limit to 17825792 bytes which is above the allowed value (attacker 'REMOTE_ADDR not set', file '%s', line 6) +16M +ALERT - script tried to increase memory_limit to 18874368 bytes which is above the allowed value (attacker 'REMOTE_ADDR not set', file '%s', line 7) +16M + diff --git a/tests/executor/memory_limit_64bit.phpt b/tests/executor/memory_limit_64bit.phpt new file mode 100644 index 0000000..35be80b --- /dev/null +++ b/tests/executor/memory_limit_64bit.phpt @@ -0,0 +1,43 @@ +--TEST-- +memory_limit test: set suhosin hard_limit to normal limit (64 bit) +--SKIPIF-- + +--INI-- +memory_limit=16M +suhosin.memory_limit=0 +suhosin.log.syslog=0 +suhosin.log.script=0 +suhosin.log.sapi=2 +--FILE-- + +--EXPECTF-- +13M +14M +15M +16M +ALERT - script tried to increase memory_limit to 17825792 bytes which is above the allowed value (attacker 'REMOTE_ADDR not set', file '%s', line 6) +16M +ALERT - script tried to increase memory_limit to 18874368 bytes which is above the allowed value (attacker 'REMOTE_ADDR not set', file '%s', line 7) +16M +ALERT - script tried to increase memory_limit to 2147483648 bytes which is above the allowed value (attacker 'REMOTE_ADDR not set', file '%s', line 8) +16M +ALERT - script tried to increase memory_limit to 3221225472 bytes which is above the allowed value (attacker 'REMOTE_ADDR not set', file '%s', line 9) +16M +ALERT - script tried to increase memory_limit to 4294967296 bytes which is above the allowed value (attacker 'REMOTE_ADDR not set', file '%s', line 10) +16M +ALERT - script tried to increase memory_limit to 5368709120 bytes which is above the allowed value (attacker 'REMOTE_ADDR not set', file '%s', line 11) +16M + diff --git a/tests/executor/memory_limit_64bit_10G.phpt b/tests/executor/memory_limit_64bit_10G.phpt new file mode 100644 index 0000000..284db50 --- /dev/null +++ b/tests/executor/memory_limit_64bit_10G.phpt @@ -0,0 +1,36 @@ +--TEST-- +memory_limit test: set suhosin hard_limit to normal limit (64 bit) - 10 GB +--SKIPIF-- + +--INI-- +memory_limit=10G +suhosin.memory_limit=0 +suhosin.log.syslog=0 +suhosin.log.script=0 +suhosin.log.sapi=2 +--FILE-- + +--EXPECTF-- +13M +14M +15M +16M +17M +18M +2G +3G +4G +5G diff --git a/tests/executor/memory_limit_negative.phpt b/tests/executor/memory_limit_negative.phpt new file mode 100644 index 0000000..7fad546 --- /dev/null +++ b/tests/executor/memory_limit_negative.phpt @@ -0,0 +1,18 @@ +--TEST-- +memory_limit test: trying to set memory_limit to a negative value +--SKIPIF-- + +--INI-- +memory_limit=16M +suhosin.memory_limit=17M +suhosin.log.syslog=0 +suhosin.log.script=0 +suhosin.log.sapi=2 +--FILE-- + +--EXPECTF-- +ALERT - script tried to disable memory_limit by setting it to a negative value -%d bytes which is not allowed (attacker 'REMOTE_ADDR not set', file '%s', line 2) +16M + diff --git a/tests/executor/memory_limit_other_hardlimit.phpt b/tests/executor/memory_limit_other_hardlimit.phpt new file mode 100644 index 0000000..cac11dc --- /dev/null +++ b/tests/executor/memory_limit_other_hardlimit.phpt @@ -0,0 +1,28 @@ +--TEST-- +memory_limit test: set suhosin hard_limit to normal limit + 1M +--SKIPIF-- + +--INI-- +memory_limit=16M +suhosin.memory_limit=17M +suhosin.log.syslog=0 +suhosin.log.script=0 +suhosin.log.sapi=2 +--FILE-- + +--EXPECTF-- +13M +14M +15M +16M +17M +ALERT - script tried to increase memory_limit to %d bytes which is above the allowed value (attacker 'REMOTE_ADDR not set', file '%s', line 7) +17M + -- cgit v1.3