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

Valgrind Report for sapi/cli/tests/bug61977.phpt ('Bug #61977 test CLI web-server support for Mime Type File extensions mapping')

Script

1: <?php
2:
include "php_cli_server.inc";
3:
php_cli_server_start('<?php ?>'null);
4:
5:
/*
6:  * If a Mime Type is added in php_cli_server.c, add it to this array and update
7:  * the EXPECTF section accordingly
8:  */
9:
$mimetypes = ['html''htm''svg''css''js''png''webm''ogv''ogg'];
10:
11: function 
test_mimetypes($mimetypes) {
12:     foreach (
$mimetypes as $mimetype) {
13:         list(
$host$port) = explode(':'PHP_CLI_SERVER_ADDRESS);
14:         
$port intval($port) ? : 80;
15:         
$fp   fsockopen($host$port$errno$errstr0.5);
16:         if (!
$fp) die('Connect failed');
17:         
file_put_contents(__DIR__ "/foo.{$mimetype}"'');
18:         
$header = <<<HEADER
19:
GET /foo.{$mimetype} HTTP/1.1
20: Host: 
{$host}
21:
22:
23:
HEADER;
24:         if (
fwrite($fp$header)) {
25:             while (!
feof($fp)) {
26:                 
$text fgets($fp);
27:                 if (
strncasecmp("Content-type:"$text13) == 0) {
28:                     echo 
"foo.{$mimetype} => "$text;
29:                 }
30:             }
31:             @
unlink(__DIR__ "/foo.{$mimetype}");
32:             
fclose($fp);
33:         }
34:     }
35: }
36:
37:
test_mimetypes($mimetypes);
38:
?>
39:

Report

==29496== Jump to the invalid address stated on the next line
==29496==    at 0x4FE: ???
==29496==    by 0x40056AF: open_verify (in /lib64/ld-2.12.so)
==29496==    by 0x4005D5A: open_path (in /lib64/ld-2.12.so)
==29496==    by 0x4008973: _dl_map_object (in /lib64/ld-2.12.so)
==29496==    by 0x400C701: openaux (in /lib64/ld-2.12.so)
==29496==    by 0x400E5E8: _dl_catch_error (in /lib64/ld-2.12.so)
==29496==    by 0x400CDE4: _dl_map_object_deps (in /lib64/ld-2.12.so)
==29496==    by 0x40034C7: dl_main (in /lib64/ld-2.12.so)
==29496==    by 0x401640D: _dl_sysdep_start (in /lib64/ld-2.12.so)
==29496==    by 0x40014D3: _dl_start (in /lib64/ld-2.12.so)
==29496==    by 0x4000B37: ??? (in /lib64/ld-2.12.so)
==29496==    by 0x5: ???
==29496==  Address 0x4fe is not stack'd, malloc'd or (recently) free'd
==29496== 
==29496== 
==29496== Process terminating with default action of signal 11 (SIGSEGV)
==29496==  Bad permissions for mapped region at address 0x4FE
==29496==    at 0x4FE: ???
==29496==    by 0x40056AF: open_verify (in /lib64/ld-2.12.so)
==29496==    by 0x4005D5A: open_path (in /lib64/ld-2.12.so)
==29496==    by 0x4008973: _dl_map_object (in /lib64/ld-2.12.so)
==29496==    by 0x400C701: openaux (in /lib64/ld-2.12.so)
==29496==    by 0x400E5E8: _dl_catch_error (in /lib64/ld-2.12.so)
==29496==    by 0x400CDE4: _dl_map_object_deps (in /lib64/ld-2.12.so)
==29496==    by 0x40034C7: dl_main (in /lib64/ld-2.12.so)
==29496==    by 0x401640D: _dl_sysdep_start (in /lib64/ld-2.12.so)
==29496==    by 0x40014D3: _dl_start (in /lib64/ld-2.12.so)
==29496==    by 0x4000B37: ??? (in /lib64/ld-2.12.so)
==29496==    by 0x5: ???

 

Generated at Thu, 20 Sep 2018 00:48:51 +0000 (4 days ago)

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