Page MenuHomePhabricator

PNG file that randomly contains a ZIP magic number is incorrectly detected as a "corrupt or otherwise unreadable ZIP file"
Open, Needs TriagePublic

Description

Trying to upload the attached PNG file results in an error message "The file is a corrupt or otherwise unreadable ZIP file. It cannot be properly checked for security." Checking it in a hex editor, it turns out that one of the magic numbers for the ZIP format, PK\x05\x06, appears at offset 0xFA4. Can this be fixed? (If not, the error message should at least be clarified.)

AncientElf-ROD-IT-VG.png (160×240 px, 14 KB)

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Umherirrender subscribed.

There is a comment in the code that says, the zip check must/should be before getimagesize() (since 1347fc05a6110b72ff918967284fae936617d57c).
getimagesize() seems to be where the png mime type is detected. Due to this order the png seems to be miss-detected.