-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Gh18976 #18977
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gh18976 #18977
Conversation
ext/standard/pack.c
Outdated
efree(formatargs); | ||
zend_value_error("Type %c: integer overflow in format string", code); | ||
RETURN_THROWS(); | ||
} | ||
INC_OUTPUTPOS((arg + (arg % 2)) / 2,1) /* 4 bit per arg */ |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
@@ -0,0 +1,14 @@ | |||
--TEST-- | |||
GH-18976 pack overflow wit h/H format |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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) |
There was a problem hiding this comment.
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
No description provided.