From eeb2803a54d2fb290ca84bfa6771c000275e1572 Mon Sep 17 00:00:00 2001 From: Meghan Denny Date: Fri, 13 Dec 2024 16:54:20 -0800 Subject: [PATCH] fix includes on linux, memmem on macos isn't posix compliant --- src/bun.js/bindings/JSBuffer.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/bun.js/bindings/JSBuffer.cpp b/src/bun.js/bindings/JSBuffer.cpp index 015667621d..8261f91b09 100644 --- a/src/bun.js/bindings/JSBuffer.cpp +++ b/src/bun.js/bindings/JSBuffer.cpp @@ -1316,7 +1316,9 @@ static int64_t indexOf(const uint8_t* thisPtr, int64_t thisLength, const uint8_t static int64_t indexOf16(const uint8_t* thisPtr, int64_t thisLength, const uint8_t* valuePtr, int64_t valueLength, int64_t byteOffset) { size_t finalresult = 0; + if (thisLength == 1) return -1; thisLength = thisLength / 2 * 2; + if (valueLength == 1) return -1; valueLength = valueLength / 2 * 2; byteOffset = byteOffset / 2 * 2; while (true) {