buffer: don't set kNoZeroFill flag in allocUnsafe#6007
buffer: don't set kNoZeroFill flag in allocUnsafe#6007vkurchatkin wants to merge 1 commit intonodejs:masterfrom
kNoZeroFill flag in allocUnsafe#6007Conversation
|
Maybe add a regression test? |
|
Tested locally and can confirm this fixes master + v5 |
|
Regression test for sure. Otherwise LGTM. |
|
LGTM pending a test. |
82396ea to
6a3236a
Compare
|
Added some tests |
|
LGTM if CI is happy |
|
LGTM |
There was a problem hiding this comment.
ha! sigh... I had uint8 on the brain I guess. good catch.
There was a problem hiding this comment.
Also -0 could be a factor, but I'm not sure. Any way, tests are a bit non-deterministic, since even if there is no actual zero filling, there is still a chance that some allocations would be zeros
There was a problem hiding this comment.
Yeah, that came up in the original review. It's not a great test. The plan was to revisit to see if the test can be made more robust.
There was a problem hiding this comment.
Also for some reason this bug is hard to reproduce with small Uint8Array.
There was a problem hiding this comment.
Looking at it now this one should have been obvious :-/. The bug only shows up after doing a pooled unsafeAlloc allocation because the zero fill flag was never being reset (because a real allocation wasn't being done).
(update: ha! I see you noted that in your commit log... it's definitely a friday)
If `kNoZeroFill` is set here, it won't be reset in case of pooled allocation. In case of "slow" allocation it will be set later anyway. Fixes: nodejs#6006
6a3236a to
abb9c4d
Compare
|
CI looks good. One unrelated failure. |
If `kNoZeroFill` is set here, it won't be reset in case of pooled allocation. In case of "slow" allocation it will be set later anyway. Fixes: #6006 PR-URL: #6007 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: Myles Borins <myles.borins@gmail.com>
|
Landed in 0dcb026 |
|
Will cherry-pick this into v5.x as well. |
If `kNoZeroFill` is set here, it won't be reset in case of pooled allocation. In case of "slow" allocation it will be set later anyway. Fixes: #6006 PR-URL: #6007 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: Myles Borins <myles.borins@gmail.com>
|
CVE? |
Pull Request check-list
make -j8 test(UNIX) orvcbuild test nosign(Windows) pass withthis change (including linting)?
test (or a benchmark) included?
existing APIs, or introduces new ones)?
Affected core subsystem(s)
buffer
Description of change
If
kNoZeroFillis set here, it won't be reset in case ofpooled allocation. In case of "slow" allocation it will be
set later anyway.
Fixes: #6006