Open Bug 1959590 Opened 19 days ago Updated 14 days ago

Oversized gif image causes high CPU load

Categories

(Core :: Graphics: ImageLib, defect, P5)

Firefox 137
defect

Tracking

()

People

(Reporter: hanno, Unassigned)

Details

Attachments

(2 files)

Having a GIF image with an extremely large pixel size (65535 x 65535), which can still be of very small file size, can cause very high CPU load in Firefox.

I'll attach an example gif, and an html file which includes it 250 times with a data uri as an iframe. (Creating an example where the image is included as a file behaves somewhat differently, causing multiple processes to have high CPU load, instead of one.)

Some possibly noteworthy observations:

  • The CPU load stays high for a long time even after closing the tab. So this can make the browser unusable even after closing the affected page.
  • At least in some cases, firefox also didn't properly stop after closing, and I had to kill the process.
  • The high CPU load only happens if the gif is loaded directly in the navigation frame or in an iframe. If the gif is loaded in an img tag, the page loads fast. It would appear that there is some different behavior in processing an image in the navigation tab vs. the img tab, possibly some protection against excessive resource consumption that only applies to img tags.

This was co-found with Sebastian Pipping, as part of investigating some bugs in the commandline tools of giflib, see also: https://sourceforge.net/p/giflib/bugs/157/

Attached file max_size_gif.zip

I took a profile of just loading one copy of the gif. I just saw downscaling of the decoded image taking time. Which is expected for such a large image.

Severity: -- → S4
Component: Graphics → Graphics: ImageLib
Priority: -- → P5
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: