buffer: add type check in bidirectionalIndexOf
Add a type check in bidirectionalIndexOf to avoid using something else as Buffer. This may happen if e.g. lastIndexOf is called with invalid this.
fixes: https://github.com/nodejs/node/issues/32753 fixes: https://github.com/nodejs/node/issues/32747