image-png icon indicating copy to clipboard operation
image-png copied to clipboard

Failed to load image: Insufficient memory

Open micahsnyder opened this issue 2 years ago • 1 comments

I found a PNG image that fails to load with image-png through image-rs with the error message: Failed to load image: Insufficient memory

170700771-8381ce45-e429-40aa-b183-064b8a944050-insufficient-memory

micahsnyder avatar Jul 09 '22 02:07 micahsnyder

That's a pretty large iTXT chunk of 1314946 bytes in there. The problem: the decoder is allocating a vector with chunk contents and it's not using the limit configured for the pixel matrix, but a separate one .

HeroicKatora avatar Jul 09 '22 11:07 HeroicKatora

Here's the same issue with more info https://github.com/image-rs/image/issues/1788

pm4rcin avatar Nov 15 '22 08:11 pm4rcin

its not just text chunks that can be so large. This image for example has a 2mb caBX (jpeg metadata in a png file) chunk before the image data starts. I will try to fix this in a PR but i'm not yet sure how to access the limits in the StreamingDecoder, any helping pointers would be very appreciated.

JMPJNS avatar Apr 06 '23 13:04 JMPJNS

@fintelia all works now https://github.com/danyspin97/wpaperd/issues/21#issuecomment-1994461074. Thanks for fixing!

pm4rcin avatar Mar 13 '24 14:03 pm4rcin