zend_hex_strtod should not use strlen
[2016-05-06 19:02 UTC] bwitz at hotmail dot com
Description: ------------ Purify reports an Invalid pointer read from zend_hex_strtod as a result of performing a strlen on the compile buffer. IPR: Invalid pointer read (3 times): * This is occurring while in thread 8137: strlen [rtlib.o] zend_hex_strtod [zend_strtod.c:2593] lex_scan [zend_language_scanner.l:1561] zendlex [zend_compile.c:6911] zendparse [zend_language_parser.c:3767] compile_file [zend_language_scanner.l:586] rnt_compile_file [rnt_opcode_cache.c:1118] ZEND_INCLUDE_OR_EVAL_SPEC_TMP_HANDLER [zend_vm_execute.h:8337] execute_ex [zend_vm_execute.h:363] zend_execute [zend_vm_execute.h:388] zend_execute_scripts [zend.c:1341] php_execute_script [main.c:2610] main [cgi_main.c:2720] __libc_start_main [libc.so.6] _start [crt1.o] * Reading 189460 bytes from 0xec44b66b between the heap and the stack (1 byte at 0xec479a7e illegal) Expected result: ---------------- Purify would not identify compilation of a php script as hitting an Invalid pointer read (IPR). In addition the strlen is quite inefficient since the compile buffer can be quite large. In this specific case, 189,460 bytes were read to determine that if (strlen(str) < 2) is false.