php / php/php-src

undefined behavior in zend_strtod.c

オープン
#19,898 コメント 1 件 リアクション 0 件 担当者 1 名 GitHub で見る

@devnexen がすでに取り組んでいます。

2025年9月20日 から。

  • #19899 @devnexen による — オープン
Bug Category: Engine Status: Verified
主要言語
C
スター
40.4k
フォーク
8.2k
平均マージ
2日 13時間
マージ済み PR(30日)
96

説明

Description

The following code:

<?php
$v_1643 = '1';
$v_1673 = '4';
$v_1674 = 1024;
$v_1675 = 1024;
$v_1676 = $v_1674 * $v_1675;
$v_1677 = 1024;
$v_1678 = $v_1676 * $v_1677;
$v_1683 = '5';
$v_1680 = $v_1678 * $v_1683;
$v_1681 = str_repeat($v_1673,$v_1680,);
$v_1651 = str_repeat($v_1643,$v_1681,);
$v_1652 = '1\n';
$v_1653 = '2';
$v_1662 = '2\n';
$v_1660 = $v_1662 * $v_1683;
$v_1661 = str_repeat($v_1653,$v_1660,);
$v_1663 = '3';
$v_1679 = 0.5;
$v_1666 = $v_1679 * $v_1668;
$v_1654 = 1024;
$v_1655 = 1024;
$v_1656 = $v_1654 * $v_1655;
$v_1668 = $v_1666 * $v_1656;
$v_1669 = 0.5;
$v_1670 = $v_1668 * $v_1669;
$v_1671 = str_repeat($v_1663,$v_1670,);
$v_1672 = '3\n';
$v_1682 = '4\n';
$v_1689 = 0.5;
$v_1690 = $v_1668 * $v_1689;
$v_1691 = str_repeat($v_1683,$v_1690,);
$v_1692 = '5\n';

Resulted in this output:

/home/w023dtc/nightly_php/php-src/Zend/zend_strtod.c:2601:50: runtime error: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /home/w023dtc/nightly_php/php-src/Zend/zend_strtod.c:2601:50 in
USE_ZEND_ALLOC=0 php -d "memory_limit = -1" -d "zend.assertions = 1" -d "display_errors = On" -d "display_startup_errors = On" -d "opcache.memory_consumption=4096M" -d "opcache.enable=1" -d "opcache.enable_cli=1" -d "opcache.jit=tracing" -d "opcache.validate_timestamps=0" -d "opcache.jit_buffer_size=128M" -d "opcache.file_update_protection=0" -d "opcache.max_accelerated_files=1000000" -d "opcache.interned_strings_buffer=64" -d "opcache.jit_prof_threshold=0.000000001" -d "opcache.jit_max_root_traces=  100000" -d "opcache.jit_max_side_traces=  100000" -d "opcache.jit_max_exit_counters=100000" -d "opcache.jit_hot_loop=1" -d "opcache.jit_hot_func=1" -d "opcache.jit_hot_return=1" -d "opcache.jit_hot_side_exit=1" -d "opcache.jit_blacklist_root_trace=255" -d "opcache.jit_blacklist_side_trace=255" -d "opcache.protect_memory=1" script.php
PHP Version
nightly
Operating System

ubuntu 22.04

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。