|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2017-09-14 09:35 UTC] geeknik at protonmail dot ch
Description:
------------
Undefined behavior in zend_strtod() triggered while fuzzing 0ee92ae.
Test script:
---------------
php -r 'var_dump(json_decode('0E2400000000'));'
Actual result:
--------------
/root/php-src/Zend/zend_strtod.c:2708:12: runtime error: signed integer overflow: 10 * 240000000 cannot be represented in type 'int'
#0 0x165763b in zend_strtod /root/php-src/Zend/zend_strtod.c:2708:12
#1 0x146c741 in lex_scan /root/php-src/Zend/zend_language_scanner.l:1742:2
#2 0x14ca10a in zendlex /root/php-src/Zend/zend_compile.c:1721:11
#3 0x143e16b in zendparse /root/php-src/Zend/zend_language_parser.c:4227:16
#4 0x144dbb2 in zend_compile /root/php-src/Zend/zend_language_scanner.l:585:7
#5 0x145010c in compile_string /root/php-src/Zend/zend_language_scanner.l:767:14
#6 0x154c4d3 in zend_eval_stringl /root/php-src/Zend/zend_execute_API.c:1068:17
#7 0x154d12b in zend_eval_stringl_ex /root/php-src/Zend/zend_execute_API.c:1121:11
#8 0x154d12b in zend_eval_string_ex /root/php-src/Zend/zend_execute_API.c:1132
#9 0x1a28558 in do_cli /root/php-src/sapi/cli/php_cli.c:1042:8
#10 0x1a26227 in main /root/php-src/sapi/cli/php_cli.c:1404:18
#11 0x7f686738eb44 in __libc_start_main /build/glibc-6V9RKT/glibc-2.19/csu/libc-start.c:287
#12 0x44159b in _start (/root/php-src/sapi/cli/php+0x44159b)
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /root/php-src/Zend/zend_strtod.c:2708:12
Patchesfix-gdtoa-overflow-2.diff (last revision 2017-09-14 12:28 UTC by jedisct1@php.net)fix-gdtoa-overflow.diff (last revision 2017-09-14 12:12 UTC by jedisct1@php.net) Pull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 07:00:01 2025 UTC |
> strtod(`0E2400000000`, NULL) returns 0, and doesn't set errno. Isn't that the correct behavior? 0e{anything} should still be zero, right? Regarding the missing check for errno, the intention here is to interpret something like 1e1000 as INF.