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/php_cli_server_014.phpt ('Bug #60477: Segfault after two multipart/form-data POST requestes')

Script

1: <?php
2:
include "php_cli_server.inc";
3:
php_cli_server_start('echo "done\n";'null);
4:
5: list(
$host$port) = explode(':'PHP_CLI_SERVER_ADDRESS);
6:
$port intval($port)?:80;
7:
$output '';
8:
9:
// note: select() on Windows (& some other platforms) has historical issues with
10: //       timeouts less than 1000 millis(0.5). it may be better to increase these
11: //       timeouts to 1000 millis(1.0) (fsockopen eventually calls select()).
12: //       see articles like: http://support.microsoft.com/kb/257821
13:
$fp fsockopen($host$port$errno$errstr0.5);
14: if (!
$fp) {
15:   die(
"connect failed");
16: }
17:
18: if(
fwrite($fp, <<<HEADER
19:
POST /index.php HTTP/1.1
20: Host: 
{$host}
21: Content-Type: multipart/form-data; boundary=---------123456789
22: Content-Length: 70
23:
24: ---------123456789
25: Content-Type: application/x-www-form-urlencoded
26: a=b
27:
HEADER
28: )) {
29:     while (!
feof($fp)) {
30:         
$output .= fgets($fp);
31:     }
32: }
33:
34:
fclose($fp);
35:
36:
$fp fsockopen($host$port$errno$errstr0.5);
37: if(
fwrite($fp, <<<HEADER
38:
POST /main/no-exists.php HTTP/1.1
39: Host: 
{$host}
40: Content-Type: multipart/form-data; boundary=---------123456789
41: Content-Length: 70
42:
43: ---------123456789
44: Content-Type: application/x-www-form-urlencoded
45: a=b
46:
HEADER
47: )) {
48:     while (!
feof($fp)) {
49:         
$output .= fgets($fp);
50:     }
51: }
52:
53: echo 
preg_replace("/<style>(.*?)<\/style>/s""<style>AAA</style>"$output), "\n";
54:
fclose($fp);
55:
56:
?>
57:

Report

==7848== Jump to the invalid address stated on the next line
==7848==    at 0x4FE: ???
==7848==    by 0x1E8799F: ??? (in /var/php_gcov/PHP_HEAD/sapi/cli/php)
==7848==    by 0x1FFEFFEEFF: ???
==7848==    by 0xD8FCFC3: ??? (in /lib64/libkrb5.so.3.3)
==7848==    by 0x1FFEFFEEFF: ???
==7848==    by 0x50: ???
==7848==    by 0x4045A8F: ???
==7848==    by 0xEAA6944D: ???
==7848==    by 0x4009EA4: do_lookup_x (in /lib64/ld-2.12.so)
==7848==    by 0x400A269: _dl_lookup_symbol_x (in /lib64/ld-2.12.so)
==7848==    by 0x400BAB3: _dl_relocate_object (in /lib64/ld-2.12.so)
==7848==    by 0x4003A08: dl_main (in /lib64/ld-2.12.so)
==7848==  Address 0x4fe is not stack'd, malloc'd or (recently) free'd
==7848== 
==7848== 
==7848== Process terminating with default action of signal 11 (SIGSEGV)
==7848==  Bad permissions for mapped region at address 0x4FE
==7848==    at 0x4FE: ???
==7848==    by 0x1E8799F: ??? (in /var/php_gcov/PHP_HEAD/sapi/cli/php)
==7848==    by 0x1FFEFFEEFF: ???
==7848==    by 0xD8FCFC3: ??? (in /lib64/libkrb5.so.3.3)
==7848==    by 0x1FFEFFEEFF: ???
==7848==    by 0x50: ???
==7848==    by 0x4045A8F: ???
==7848==    by 0xEAA6944D: ???
==7848==    by 0x4009EA4: do_lookup_x (in /lib64/ld-2.12.so)
==7848==    by 0x400A269: _dl_lookup_symbol_x (in /lib64/ld-2.12.so)
==7848==    by 0x400BAB3: _dl_relocate_object (in /lib64/ld-2.12.so)
==7848==    by 0x4003A08: dl_main (in /lib64/ld-2.12.so)

 

Generated at Sat, 09 Sep 2017 03:10:54 +0000 (14 days ago)

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