PHP  
 PHP_HEAD
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

Valgrind Report for sapi/cli/tests/upload_2G.phpt ('file upload greater than 2G')

Script

1: <?php
2:
3:
echo "Test\n";
4:
5: include 
"php_cli_server.inc";
6:
7:
php_cli_server_start("var_dump(\$_FILES);"false,
8:     
"-d post_max_size=3G -d upload_max_filesize=3G");
9:
10: list(
$host$port) = explode(':'PHP_CLI_SERVER_ADDRESS);
11:
$port intval($port)?:80;
12:
$length 2150000000;
13:
$output "";
14:
15:
$fp fsockopen($host$port$errno$errstr0.5);
16: if (!
$fp) {
17:   die(
"connect failed");
18: }
19:
20:
$prev "----123
21: Content-Type: text/plain; charset=UTF-8
22: Content-Disposition: form-data; name=\"file1\"; filename=\"file1.txt\"\n\n"
;
23:
$post "\n----123--\n";
24:
$total $length strlen($prev) + strlen($post);
25:
26:
fwrite($fp, <<<EOF
27:
POST /index.php HTTP/1.1
28: Host: 
{$host}
29: Content-Type: multipart/form-data; boundary=--123
30: Content-Length: 
{$total}
31:
32:
{$prev}
33:
EOF
34: ) or die(
"write prev failed");
35:
36:
$data str_repeat("0123456789"10000);
37: for (
$i 0$i $length$i += 10000 10) {
38:     
fwrite($fp$data) or die("write failed @ ($i)");
39: }
40:
41:
fwrite($fp$post) or die("write post failed");
42:
43: while (!
feof($fp)) {
44:     
$output .= fgets($fp);
45: }
46: echo 
$output;
47:
fclose($fp);
48:
?>
49:
Done
50:

Report

==18040== Jump to the invalid address stated on the next line
==18040==    at 0x4FE: ???
==18040==  Address 0x4fe is not stack'd, malloc'd or (recently) free'd
==18040== 
==18040== 
==18040== Process terminating with default action of signal 11 (SIGSEGV)
==18040==  Bad permissions for mapped region at address 0x4FE
==18040==    at 0x4FE: ???

 

Generated at Sun, 12 Nov 2017 21:17:35 +0000 (4 days ago)

Copyright © 2005-2017 The PHP Group
All rights reserved.