PHP  
 PHP_HEAD
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

==29315== Invalid write of size 8
==29315==    at 0x5AAB21: pcre_jit_exec (pcre_jit_compile.c:11572)
==29315==    by 0x5B3360: php_pcre_replace_func_impl (php_pcre.c:1593)
==29315==    by 0x5B5279: php_pcre_replace_func (php_pcre.c:1730)
==29315==    by 0x5B5279: php_replace_in_subject_func (php_pcre.c:1864)
==29315==    by 0x5B58EE: preg_replace_func_impl (php_pcre.c:1911)
==29315==    by 0x5B80AA: zif_preg_replace_callback (php_pcre.c:2074)
==29315==    by 0x11BD9D3: ZEND_DO_ICALL_SPEC_RETVAL_USED_HANDLER (zend_vm_execute.h:617)
==29315==    by 0x1339863: execute_ex (zend_vm_execute.h:59726)
==29315==    by 0x10AEFFD: zend_call_function (zend_execute_API.c:817)
==29315==    by 0x5B1124: preg_do_repl_func (php_pcre.c:1201)
==29315==    by 0x5B3592: php_pcre_replace_func_impl (php_pcre.c:1623)
==29315==    by 0x5B5279: php_pcre_replace_func (php_pcre.c:1730)
==29315==    by 0x5B5279: php_replace_in_subject_func (php_pcre.c:1864)
==29315==    by 0x5B58EE: preg_replace_func_impl (php_pcre.c:1911)
==29315==  Address 0x1ffeffa1c8 is on thread 1's stack
==29315==  3016 bytes below stack pointer
==29315== 

 

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

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