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

Valgrind Report for ext/pcre/tests/preg_replace_callback.phpt ('preg_replace_callback()')

Script

1: <?php
2: $input 
"plain [indent] deep [indent] [abcd]deeper[/abcd] [/indent] deep [/indent] plain"
3:
4: function 
parseTagsRecursive($input)
5: {
6:     
7:     
$regex '#\[indent]((?:[^[]|\[(?!/?indent])|(?R))+)\[/indent]#';
8:
9:     if (
is_array($input)) {
10:         
$input '<div style="margin-left: 10px">'.$input[1].'</div>';
11:     }
12:
13:     return 
preg_replace_callback($regex'parseTagsRecursive'$input);
14: }
15:
16:
$output parseTagsRecursive($input);
17:
18: echo 
$output"\n";
19:
20:
?>
21:

Report

==858== Invalid write of size 8
==858==    at 0x5AD148: php_pcre_jit_exec (pcre_jit_compile.c:11572)
==858==    by 0x5B5A97: php_pcre_replace_func_impl (php_pcre.c:1621)
==858==    by 0x5B79B0: php_pcre_replace_func (php_pcre.c:1758)
==858==    by 0x5B79B0: php_replace_in_subject_func (php_pcre.c:1892)
==858==    by 0x5B8025: preg_replace_func_impl (php_pcre.c:1939)
==858==    by 0x5BA7E1: zif_preg_replace_callback (php_pcre.c:2102)
==858==    by 0x11C0812: ZEND_DO_ICALL_SPEC_RETVAL_USED_HANDLER (zend_vm_execute.h:617)
==858==    by 0x133C718: execute_ex (zend_vm_execute.h:59726)
==858==    by 0x10B0F6D: zend_call_function (zend_execute_API.c:817)
==858==    by 0x5B385B: preg_do_repl_func (php_pcre.c:1229)
==858==    by 0x5B5CC9: php_pcre_replace_func_impl (php_pcre.c:1651)
==858==    by 0x5B79B0: php_pcre_replace_func (php_pcre.c:1758)
==858==    by 0x5B79B0: php_replace_in_subject_func (php_pcre.c:1892)
==858==    by 0x5B8025: preg_replace_func_impl (php_pcre.c:1939)
==858==  Address 0x1ffeffa1c8 is on thread 1's stack
==858==  3016 bytes below stack pointer
==858== 

 

Generated at Fri, 15 Dec 2017 07:20:55 +0000 (10 hours ago)

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