Skip to content

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

Open
kawanet wants to merge 1 commit intohyperdivision:masterfrom
kawanet:fix/over-64KB
Open

RangeError: offset is out of bounds (64KB+)#2
kawanet wants to merge 1 commit intohyperdivision:masterfrom
kawanet:fix/over-64KB

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