Skip to content

Unexpected termination (-nan is outside the range) in ext/standard/basic_functions.c #14774

Closed

Description

@YuanchengJiang

Description

The following code:

<?php
$values1 = array(234, false);
$values2 = array(2, false);
for ($i = 0; $i < count($values1); $i++) {
        for ($j = 0; $j < count($values2); $j++) {
        $res = fmod($values1[$i], $values2[$j]);
        }
}
time_sleep_until($res);

Resulted in this output:

Terminated

ASan:

/php-src/ext/standard/basic_functions.c:1207:14: runtime error: -nan is outside the range of representable values of type 'unsigned long'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /php-src/ext/standard/basic_functions.c:1207:14

PHP Version

PHP 8.4.0-dev

Operating System

ubuntu 22.04

Activity

  1. self-assigned this
    on Jul 3, 2024
  2. added a commit that references this issue on Jul 6, 2024
    2375187
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions