buffer: fix lastIndexOf crash for overlong needle
Return -1 in `Buffer.lastIndexOf` if the needle is longer than the haystack. The previous check only tested the corresponding condition for forward searches. This applies only to Node.js v6, as `lastIndexOf` was added in it. Fixes: https://github.com/nodejs/node/issues/6510 PR-URL: https://github.com/nodejs/node/pull/6511 Reviewed-By:James M Snell <jasnell@gmail.com> Reviewed-By:
Trevor Norris <trev.norris@gmail.com>
parent
bfe645d1
Please register or sign in to comment