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

crash on putImageData() #973

Open
monteslu opened this issue Jan 13, 2025 · 0 comments
Open

crash on putImageData() #973

monteslu opened this issue Jan 13, 2025 · 0 comments
Assignees

Comments

@monteslu
Copy link

There's a crash with putImageData() when trying to use the resize parameters:

import { createCanvas } from '@napi-rs/canvas';

const canvas = createCanvas(1920, 1080);
const ctx = canvas.getContext('2d');

const canvas2 = createCanvas(640, 480);
const ctx2 = canvas2.getContext('2d');
ctx2.fillStyle = 'white';
ctx2.fillRect(0, 0, canvas2.width, canvas2.height);

let imgData = ctx2.getImageData(0, 0, canvas2.width, canvas2.height);

//this crashes
ctx.putImageData(imgData, 0, 0, canvas.width, canvas.height);

//this crashes too
ctx.putImageData(imgData, 0, 0, 0, 0, canvas.width, canvas.height);


//this ok
ctx.putImageData(imgData, 0, 0);

on an M2 mac, sequoia 15.2 this results in :

node(58082,0x209bdc240) malloc: *** error for object 0x4cd62630000: pointer being freed was not allocated
node(58082,0x209bdc240) malloc: *** set a breakpoint in malloc_error_break to debug

on Linux this results in :

free(): invalid pointer
Aborted (core dumped)
@Brooooooklyn Brooooooklyn self-assigned this Jan 14, 2025
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

No branches or pull requests

2 participants