summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/standard/tests/strings/wordwrap_memory_limit.phpt1
-rw-r--r--ext/standard/tests/strings/wordwrap_memory_limit_win32.phpt19
2 files changed, 20 insertions, 0 deletions
diff --git a/ext/standard/tests/strings/wordwrap_memory_limit.phpt b/ext/standard/tests/strings/wordwrap_memory_limit.phpt
index fb0cc5c3bc..21340153fa 100644
--- a/ext/standard/tests/strings/wordwrap_memory_limit.phpt
+++ b/ext/standard/tests/strings/wordwrap_memory_limit.phpt
@@ -2,6 +2,7 @@
No overflow should occur during the memory_limit check for wordwrap()
--SKIPIF--
<?php
+if (substr(PHP_OS, 0, 3) == 'WIN' && PHP_INT_SIZE == 4) die("skip this test is not for 32bit Windows platforms");
if (getenv("USE_ZEND_ALLOC") === "0") die("skip Zend MM disabled");
?>
--INI--
diff --git a/ext/standard/tests/strings/wordwrap_memory_limit_win32.phpt b/ext/standard/tests/strings/wordwrap_memory_limit_win32.phpt
new file mode 100644
index 0000000000..e0e76b5800
--- /dev/null
+++ b/ext/standard/tests/strings/wordwrap_memory_limit_win32.phpt
@@ -0,0 +1,19 @@
+--TEST--
+No overflow should occur during the memory_limit check for wordwrap()
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN' || PHP_INT_SIZE != 4) die("skip this test is for 32bit Windows platforms only");
+if (getenv("USE_ZEND_ALLOC") === "0") die("skip Zend MM disabled");
+?>
+--INI--
+memory_limit=128M
+--FILE--
+<?php
+
+$str = str_repeat('x', 65534);
+$str2 = str_repeat('x', 65535);
+wordwrap($str, 1, $str2);
+
+?>
+--EXPECTF--
+Fatal error: Possible integer overflow in memory allocation (4294901777 + %d) in %s on line %d