Skip to content

PHP crash with JIT enabled #12481

Closed
Closed
@terax6669

Description

@terax6669

Description

I'm using google/protobuf v3.24.4.
The following code:

<?php
$codedInputStream->readVarint32($value);

Resulted in: PHP process crash with exit code 5

Changing $var &= 0xFFFFFFFF; to $var = $var & 0xFFFFFFFF; as well as removing all the PHP_INT_SIZE conditions resolves the issue.
The error doesn't always occur in the same place (it's somewhat random +- a few lines/loops), but can be consistently reproduced. Also it seems to only occur when you do it very fast in a loop enough times. Adding a bunch of debug output slowed down my console to the point where the error did not occur anymore and the process successfully finished.

Not sure how else I could help reproduce the issue on your side, I'm not at liberty to share the data I'm processing.

PHP Version

PHP 8.2.11 (cli) (built: Sep 26 2023 15:25:31) (ZTS Visual C++ 2019 x64)
PHP 8.3.1 (cli) (built: Dec 20 2023 14:06:10) (ZTS Visual C++ 2019 x64)
PHP 8.3.1 (cli) (built: Dec 20 2023 14:06:30) (NTS Visual C++ 2019 x64)

Operating System

Windows 11

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions