[php-src] Issue #15150: Invalid value range in ext/date/lib/interval.c

From: Date: Mon, 29 Jul 2024 08:14:40 +0000
Subject: [php-src] Issue #15150: Invalid value range in ext/date/lib/interval.c
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-247391@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/15150 Author: YuanchengJiang ### Description The following code: ```php <?php foreach ([PHP_INT_MIN, PHP_INT_MAX] as $extreme) { $i = 64; while ($i-- > 1) { $d = new DateTime('@' . ($extreme >> $i)); } } $script1_dataflow = $d; $datetime3 = new DateTime('13-03-02'); $interval = $script1_dataflow->diff($datetime3); ``` Resulted in this output: ``` /php-src/ext/date/lib/interval.c:204:10: runtime error: 5.3376e+13 is outside the range of representable values of type 'int' SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /php-src/ext/date/lib/interval.c:204:10 in ``` ### PHP Version PHP 8.4.0-dev ### Operating System ubuntu 22.04

« previous php.bugs (#247391) next »