]> granicus.if.org Git - php/commitdiff
adding test for #68986
authorNayana Hettiarachchi <nayana@ddproperty.com>
Thu, 5 Feb 2015 06:28:40 +0000 (14:28 +0800)
committerNayana Hettiarachchi <nayana@ddproperty.com>
Thu, 5 Feb 2015 06:28:40 +0000 (14:28 +0800)
tests/basic/bug68986.phpt [new file with mode: 0644]

diff --git a/tests/basic/bug68986.phpt b/tests/basic/bug68986.phpt
new file mode 100644 (file)
index 0000000..7827b78
--- /dev/null
@@ -0,0 +1,23 @@
+--TEST--
+Bug #68986 (pointer returned by php_stream_fopen_temporary_file not validated in memory.c)
+--INI--
+default_charset=UTF-8
+--FILE--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+       die('skip.. only for unix');
+}
+
+$tempDir = getenv("TMPDIR");
+mkdir($tempDir . '/php68986');
+system("chmod 444 " . $tempDir . '/php68986');
+putenv("TMPDIR=" . $tempDir . '/php68986');
+
+$fp = fopen('php://temp', 'r+');
+$data = implode('', array_fill(0, (1024 * 1024 * 2), 'A'));
+var_dump(fwrite($fp, $data)); 
+fclose($fp);
+rmdir($tempDir . '/php68986');
+
+--EXPECT--
+int(2088960)