Skip to content

Conversation

@devnexen
Copy link
Member

No description provided.

@devnexen devnexen linked an issue Jun 29, 2025 that may be closed by this pull request
zend_value_error("Type %c: integer overflow in format string", code);
RETURN_THROWS();
}
INC_OUTPUTPOS((arg + (arg % 2)) / 2,1) /* 4 bit per arg */
Copy link
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
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
@@ -0,0 +1,14 @@
--TEST--
GH-18976 pack overflow wit h/H format
Copy link
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)

@@ -0,0 +1,14 @@
--TEST--
GH-18976 (pack overflow wit h/H format)
Copy link
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