Skip to content

Gh18976 - #18977

Closed
devnexen wants to merge 1 commit into
php:PHP-8.3from
devnexen:gh18976
Closed

Gh18976#18977
devnexen wants to merge 1 commit into
php:PHP-8.3from
devnexen:gh18976

Conversation

@devnexen

Copy link
Copy Markdown
Member

No description provided.

@devnexen devnexen linked an issue Jun 29, 2025 that may be closed by this pull request
Comment thread ext/standard/pack.c Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another approach may be to compute arg/2 + arg%2 instead. I believe this does the same thing but can't overflow.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok that s more efficient.

@devnexen
devnexen marked this pull request as ready for review June 29, 2025 13:30
@devnexen
devnexen requested a review from bukka as a code owner June 29, 2025 13:30
Comment thread ext/standard/tests/strings/gh18976.phpt Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
GH-18976 pack overflow wit h/H format
GH-18976 (pack overflow with h/H format)

Comment thread ext/standard/tests/strings/gh18976.phpt Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still missing the h in with

adding with its own remainder, INT_MAX overflows here (negative values are
discarded).

close phpGH-18977
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Signed Integer Overflow in pack()

2 participants