Backport important Buffer changes to v5.x
This backports three two Buffer
-related commits to 5.x
-
allocUnsafeSlow
introduction from #5833.Buffer.alloc
andBuffer.allocUnsafe
are already backported to 5.x, whileBuffer.allosUnsafeSlow
isn't — that could be unexpected by users. The good thing is thatallocUnsafeSlow
(asSlowBuffer
) is hopefully rarely used.This is a backport and was significantly changed from the original commit — it does not modify any existing code or tests, it just adds the new API method and tests for it. No deprecation is introduced in the docs.
-
ignore negative allocation lengths
from #7051 — security-related.Merged in #7221.
-
add buffer testcase for resetting kZeroFill
from #7093 — testcase forsafeguard against accidental kNoZeroFill
.This landed cleanly.
/cc @jasnell @trevnorris @bnoordhuis @addaleax