Skip to content

UBSan abort in ext/sockets/sockets.c:373 #16267

Closed

Description

@YuanchengJiang

Description

The following code:

<?php
socket_strerror(-2147483648);

Resulted in this output:

/php-src/ext/sockets/sockets.c:373:11: runtime error: negation of -2147483648 cannot be represented in type 'int'; cast to an unsigned type to negate this value to itself
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /php-src/ext/sockets/sockets.c:373:11

Such bugs look nonsensical to me. Shall I keep reporting them?

PHP Version

PHP 8.4.0-dev

Operating System

ubuntu 22.04

Activity

  1. self-assigned this
    on Oct 6, 2024
  2. added 2 commits that reference this issue on Oct 6, 2024
    6cf8825
    8537aa6
  3. YuanchengJiang commented on Nov 28, 2024

    @YuanchengJiang
    Author

    it happens again in the latest commit

  4. devnexen commented on Nov 28, 2024

    @devnexen
    Member

    I can t reproduce with last master, how does it look to you in ext/sockets/sockets.c around line 1258 (I assume you run 64 bits ubuntu) ? Actually I can, will make a PR

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