Skip to content

byteOffset of typedArray is not handled properly #3145

@codepage949

Description

@codepage949

sharp/lib/input.js

Lines 38 to 42 in b609df4

} else if (is.typedArray(input)) {
if (input.length === 0) {
throw Error('Input Bit Array is empty');
}
inputDescriptor.buffer = Buffer.from(input.buffer);

i think L42 should be like below to handle typedArray with byteOffset.

inputDescriptor.buffer = Buffer.from(input.buffer, input.byteOffset, input.byteLength);

using byteOffset seems unusal case but it will be nice to handle it.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions