-
Notifications
You must be signed in to change notification settings - Fork 30.6k
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
crypto: make malloc failure check cross-platform #8352
Conversation
This seems to work. Removing Hopefully this is an acceptable short term workaround if it is not acceptable as a permanent fix. Guess I better start looking around the code to see if anything bad could happen to that null pointer... |
`malloc(0)` may return NULL on some platforms. Do not report out-of-memory error unless `malloc` was passed a number greater than `0`. Fixes: nodejs#7564 PR-URL: nodejs#8352
Fixes three of the four current perma-flaky tests on AIX. SmartOS failure looks unrelated. CI again: https://ci.nodejs.org/job/node-test-pull-request/3901/ |
See also #7564. I wasn't very happy with that approach but, mea culpa, I didn't get around to posting the alternative solution I talked about. I suppose any fix is better than no fix at this point. |
LGTM, if it works |
LGTM |
1 similar comment
LGTM |
I'd prefer to land #7564 as it addresses the general problem as opposed to the specific problem that this patch addresses. However, I'm not opposed to landing this as well as it would be better not to depend on the platform specific malloc(0) behavior in this specific case. So LTGM to land this but @bnoordhuis can you also give me an LTGM on #7564 as well so that I could land it. |
Would I be correct to infer that folks providing |
@Trott Yes, using |
Based on the way that @bnoordhuis suggested that I change the implementation we'll need this fix as it moves all platforms so that we'll consistently get a nullptr for malloc(0). To be able to test I cherry picked this across/resolved merge issues so might make sense to land them together. Just about to push 2 commits to #7564 and then do a CI run to make sure all it ok across platforms. |
`malloc(0)` may return NULL on some platforms. Do not report out-of-memory error unless `malloc` was passed a number greater than `0`. Fixes: nodejs#7564 PR-URL: nodejs#8352
`malloc(0)` may return NULL on some platforms. Do not report out-of-memory error unless `malloc` was passed a number greater than `0`. PR-URL: #8352 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Fedor Indutny <fedor@indutny.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Landed as ed640ae |
`malloc(0)` may return NULL on some platforms. Do not report out-of-memory error unless `malloc` was passed a number greater than `0`. PR-URL: #8352 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Fedor Indutny <fedor@indutny.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
`malloc(0)` may return NULL on some platforms. Do not report out-of-memory error unless `malloc` was passed a number greater than `0`. PR-URL: #8352 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Fedor Indutny <fedor@indutny.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
@mhdawson should this be backported? |
@Trott backport? edit: does not land cleanly |
@thealphanerd I believe it is only needed if and only if https://github.com/nodejs/node/commit/a00ccb0fb9eb716925058b0a20fcec9251de3309/ / #7564 lands. That PR is currently marked as "do not land" so I think this too should be marked that way. |
Agreed. |
Checklist
make -j4 test
(UNIX), orvcbuild test nosign
(Windows) passesAffected core subsystem(s)
crypto
Description of change
malloc(0)
may return NULL on some platforms. Do not reportout-of-memory error unless
malloc
was passed a number greater than0
.Marking as
in progress
for the moment. This is an attempt to fix some of the perma-flaky tests on AIX.