diff --git a/src/bun.js/bindings/JSBuffer.cpp b/src/bun.js/bindings/JSBuffer.cpp index 44b570be30c374..70b15b93a77a6b 100644 --- a/src/bun.js/bindings/JSBuffer.cpp +++ b/src/bun.js/bindings/JSBuffer.cpp @@ -1411,8 +1411,8 @@ static int64_t indexOfNumber(JSC::JSGlobalObject* lexicalGlobalObject, bool last if (last) { #if OS(LINUX) #ifdef __GNU_LIBRARY__ - const void* offset = memrchr(reinterpret_cast(typedVector + byteOffset), byteValue, byteLength - byteOffset); - if (offset != NULL) return static_cast(offset) - typedVector; + const void* offset = memrchr(reinterpret_cast(typedVector), byteValue, byteOffset + 1); + if (offset != NULL) return static_cast(offset) - (typedVector); return -1; #endif #endif