Commit 200429e9 authored by Anna Henningsen's avatar Anna Henningsen Committed by Myles Borins
Browse files

buffer: ignore negative allocation lengths

Treat negative length arguments to `Buffer()`/`allocUnsafe()`
as if they were zero so the allocation does not affect the
pool’s offset.

Fixes: https://github.com/nodejs/node/issues/7047

Refs: https://github.com/nodejs/node/pull/7051
Refs: https://github.com/nodejs/node/pull/7221
Refs: https://github.com/nodejs/node/pull/7475
PR-URL: https://github.com/nodejs/node/pull/7562


Reviewed-By: default avatarTrevor Norris <trev.norris@gmail.com>
Reviewed-By: default avatarJames M Snell <jasnell@gmail.com>
Reviewed-By: default avatarNikolai Vavilov <vvnicholas@gmail.com>
parent e544b1c4
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment