fix: single image/size ico conversion memory leak (#252)

why was it being read like this. fixes #252
This commit is contained in:
Maya 2026-05-25 22:44:57 +03:00
parent ed9e18c052
commit 35ccc6f709
No known key found for this signature in database
1 changed files with 6 additions and 16 deletions

View File

@ -65,22 +65,12 @@ const handleMessage = async (
// special ico handling to split them all into separate images // special ico handling to split them all into separate images
if (from === ".ico") { if (from === ".ico") {
const imgs = MagickImageCollection.create(); const imgs = MagickImageCollection.create();
imgs.read(
while (true) { new Uint8Array(buffer),
try { new MagickReadSettings({
const img = MagickImage.create( format: MagickFormat.Ico,
new Uint8Array(buffer), }),
new MagickReadSettings({ );
format: MagickFormat.Ico,
frameIndex: imgs.length,
}),
);
imgs.push(img);
// eslint-disable-next-line @typescript-eslint/no-unused-vars
} catch (_) {
break;
}
}
if (imgs.length === 0) { if (imgs.length === 0) {
return { return {