Bug 50779

Summary: Large PNG images need a more robust size check
Product: WebKit Reporter: Cosmin Truta <ctruta>
Component: ImagesAssignee: Nobody <webkit-unassigned>
Status: RESOLVED INVALID    
Severity: Normal    
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   

Description Cosmin Truta 2010-12-09 12:29:42 PST
Currently, PNG images of size 1000001x1 (1 megapixel, single-row or single-column) are rejected, while images of size 999999x999999 (ginormous, a little below 1 terapixel) are accepted by PNGImageDecoder. And yet, the difference in memory requirements between the two images is huge.
I propose the following limits:
image length: 2^20 - 1
image area: 2^29 - 1
The rationale for the image area limit is that RGBA images at 8 bits per channel should occupy no more than 2^31 bytes.

I wouldn't even mind if the image length restrictions were lifted, and all that's required were the 2^29 limit for the image area.
Comment 1 Cosmin Truta 2010-12-09 13:22:57 PST
Actually, I've just noticed that ImageDecoder::isOverSize does check that area is below 2^29.
Changing the bug status to INVALID.