buffer: fix lastIndexOf and indexOf in various edge cases
Checklist
-
tests and code linting passes -
a test and/or benchmark is included -
the commit message follows commit guidelines
Affected core subsystem(s)
buffer
Description of change
Return -1 in Buffer.lastIndexOf
if the needle is longer than the haystack. The previous check only tested the corresponding condition for forward searches.