Skip to content

Conversation

@codebytere
Copy link
Member

@codebytere codebytere commented Jul 10, 2025

Refs https://chromium-review.googlesource.com/c/chromium/src/+/6703757

The above CL enabled array bounds sanitization for Electron and therefore Node.js, which triggered
a crash in parallel/test-buffer-indexof.js. Upon a bit more investigation, some Boyer-Moore related functions
function were using biased pointer arithmetic to create array pointers that point outside the actual array bounds.

When start_ is large this creates pointers far outside the valid memory range. The sanitizer detects that we're creating and dereferencing pointers outside array boundaries, even though the final memory access happens to land in valid memory.

This changes the functions to use bounds-safe array indexing.

@codebytere codebytere requested review from anonrig and jasnell July 10, 2025 09:02
@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/security-wg

@nodejs-github-bot nodejs-github-bot added dependencies Pull requests that update a dependency file. needs-ci PRs that need a full CI run. labels Jul 10, 2025
@codebytere codebytere force-pushed the fix-boyer-moore-ub branch from 146ee54 to f9a42c7 Compare July 10, 2025 09:03
@codebytere codebytere changed the title fix: Boyer-Moore array bounds safety rcs: Boyer-Moore array bounds safety Jul 10, 2025
@codebytere codebytere changed the title rcs: Boyer-Moore array bounds safety src: Boyer-Moore array bounds safety Jul 10, 2025
@codebytere codebytere force-pushed the fix-boyer-moore-ub branch from f9a42c7 to 44df0f4 Compare July 10, 2025 09:04
@codebytere codebytere changed the title src: Boyer-Moore array bounds safety src: fix Boyer-Moore array bounds safety Jul 10, 2025
@addaleax
Copy link
Member

This should probably be a PR against https://github.com/nodejs/nbytes, right?

@codebytere
Copy link
Member Author

Oops you're right - for some reason i thought module extraction hadn't fully completed yet. done at nodejs/nbytes#7

@codebytere codebytere closed this Jul 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants