buffer: fix lastIndexOf index underflow issue
Fix `buffer.lastIndexOf()` for the case that the first character of the needle is contained in the haystack, but in a location that makes it impossible to be part of a full match. For example, when searching for 'abc' in 'abcdef', only the 'cdef' part needs to be searched for 'c', because earlier locations can be excluded by index calculations alone. Previously, such a search would result in an assertion failure. This applies only to Node.js v6, as `lastIndexOf` was added in it. 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
55b975d4
Please register or sign in to comment