Commit a02b13fe authored by cjihrig's avatar cjihrig
Browse files

buffer: coerce offset using Math.trunc()

This is a partial revert of
14d1a8a6, which coerced the offset
of Buffer#slice() using the | operator. This causes some edge
cases to be handled incorrectly. This commit restores the old
behavior, but converts offsets to integers using Math.trunc().
This commit does not revert any tests, and adds an additional
regression test.

Refs: https://github.com/nodejs/node/issues/9096
Refs: https://github.com/nodejs/node/pull/9101
PR-URL: https://github.com/nodejs/node/pull/9341


Reviewed-By: default avatarSakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: default avatarJames M Snell <jasnell@gmail.com>
Reviewed-By: default avatarBrian White <mscdex@mscdex.net>
Reviewed-By: default avatarTrevor Norris <trev.norris@gmail.com>
parent 37909785
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