Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RangeError: offset is out of bounds (64KB+) #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kawanet
Copy link

@kawanet kawanet commented Sep 8, 2021

It fails for input data larger than 64KB.

The patch performs realloc() automatically at the case.

Without the patch, the following test fails:

  assert.equal(murmur3(Buffer.alloc(65537)) >>> 0, 1955252949, '65537 bytes')
./index.js:18
  mod.memory.set(buf, 0)
             ^

RangeError: offset is out of bounds
    at Uint8Array.set (<anonymous>)
    at murmur3Hash (./index.js:18:14)
    at Test.<anonymous> (./test.js:45:16)
    at Test.bound [as _cb] (./node_modules/tape/lib/test.js:88:32)
    at Test.run (./node_modules/tape/lib/test.js:105:10)
    at Test.bound [as run] (./node_modules/tape/lib/test.js:88:32)
    at Immediate.next (./node_modules/tape/lib/results.js:82:19)
    at processImmediate (node:internal/timers:464:21)

Note that there are no way to decrease memory consumption after realloc-ed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant