-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Add reallocarray
implementation.
#8871
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
Conversation
In a similar model as _safe_*alloc api but for the `userland` it guards against overflow before (re)allocation, usage concealed in fpm for now. Modern Linux and most of BSD already have it.
Might it make sense to move this to zend_alloc.h/c? Maybe it could also take the persistent flag and the call pemalloc to make to make it more generally usable? The name could also be something like safe_pemalloc_try or similar to make it more discoverable for people who know the existing functions. Let's see what others think first. |
I think zend_alloc.c is not the proper place for this polyfill. However, if we were to add a ereallocarray() / pereallocarray(), these functions would belong in zend_alloc.c/h. |
Exactly, goal is to be used just like the libc's realloc. Saying this another PR could add a similar part, feature-wise, in the zend's side. |
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, then let's go with no pemalloc
for now, we can always add it later if there's a use-case at some point.
1bdd07e
to
21fc74b
Compare
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.
LGTM
Sort of php#8871 follow-up but on the zend part.
Sort of php#8871 follow-up but on the zend part.
Sort of php#8871 follow-up but on the zend part.
In a similar model as safe*alloc api but for the
userland
it guardsagainst overflow before (re)allocation, usage concealed in fpm for now.
Modern Linux and most of BSD already have it.