magick-wasm icon indicating copy to clipboard operation
magick-wasm copied to clipboard

Error while reading AVIF image

Open nathan-nusign opened this issue 5 months ago • 2 comments

magick-wasm version

0.0.32

Description

Using a sample file I found online I get an error while reading

Error: Memory allocation error: Security limit exceeded: Maximum number of child boxes (100) in 'ipco' box exceeded. (6.1000)

I don't get this error when using 0.0.31

Steps to Reproduce

ImageMagick.read(new Uint8Array(buffer), 'AVIF', console.log);

Images

https://sample-files-online.com/samples/countdownload/815

nathan-nusign avatar Jun 10 '25 10:06 nathan-nusign

Can you please add the file here? You might need to zip it before dragging it GitHub. I suspect that this is happening because the heif library recently added some security limits. Will investigate and get back to you once you have uploaded the file here.

dlemstra avatar Jun 10 '25 10:06 dlemstra

Adding file for future reference: 1718924786_aniC6mEngif_file-converters-online.com_ytC.zip

Yes you are hitting a heic security limit:

Memory allocation error: Security limit exceeded: Maximum number of child boxes (100) in 'ipco' box exceeded.

I can read your file with these settings but you might want to tweak that value:

const settings = new MagickReadSettings();
settings.setDefine(MagickFormat.Heic, 'max-children-per-box', 1000);
ImageMagick.read(new Uint8Array(buffer), settings, console.log);

dlemstra avatar Sep 08 '25 20:09 dlemstra