dumbmatter / fakeIndexedDB

A pure JS in-memory implementation of the IndexedDB API
Apache License 2.0
562 stars 69 forks source link

`Uint8Array` keys don't respect offsets from underlying ArrayBuffers #89

Closed joeltg closed 10 months ago

joeltg commented 10 months ago

In valueToKey, when you convert from Uint8Array or other data view (tested by ArrayBuffer.isView), the code currently returns new Uint8Array(input.buffer).buffer. This disregards the byteOffset and byteLength, which might only reference a slice of the underlying ArrayBuffer.

dumbmatter commented 10 months ago

Thanks you're right, does PR #90 look like a good fix?

joeltg commented 10 months ago

Yeah that looks great!

dumbmatter commented 10 months ago

Fixed in v5.0.1