Open Bug 1693190 Opened 4 years ago Updated 10 months ago

PNG image with invalid chunk type is not loaded in Firefox. Chrome ignores error and displays image

Categories

(Core :: Graphics: ImageLib, defect)

Unspecified
Android
defect

Tracking

()

People

(Reporter: kbrosnan, Unassigned)

References

Details

Attachments

(1 file)

From github: https://github.com/mozilla-mobile/fenix/issues/18008.

Steps to reproduce

  1. Download attachment image
  2. Install and enable Wifi File Transfer
  3. Input the IP location given by Wifi File Transfer
  4. Find the downloaded image
  5. Open with Firefox

Expected behavior

The image should be display without any problem

Actual behavior

After the image is opened, the image is displayed on screen, suddenly it was replaced by a text http://192.168.1.103:1234/storage/emulated/0/Download/250px-Coreldraw_x8.png on grey background.

Device information

  • Device vendor / model and Android version: Galaxy S6, Android 7
  • Firefox for Android version: 85.1.3

Attachment

Change performed by the Move to Bugzilla add-on.

Running pngcheck against the image outputs

.\108021044-adc90f00-7058-11eb-8567-c4822f985e79.png  CRC error in chunk tEXt (computed f237937e, expected 61775f78)
ERROR: ..\108021044-adc90f00-7058-11eb-8567-c4822f985e79.png
Summary: PNG image with bad CRC is not loaded in Firefox Chrome ignores error and displays image → PNG image with bad CRC is not loaded in Firefox. Chrome ignores error and displays image

Can you upload the png file?

Flags: needinfo?(kbrosnan)

Oh the Move to Bugzilla extension truncated that section. Sure

Flags: needinfo?(kbrosnan)
See Also: → 1225679
See Also: → 1245975

From bug 1225679, comment 5 Chrome seems to ignore crc failures in IDAT (image data) chunks, IE ignored crc failures in IHDR and IDAT chunks. Ignoring the crc for text chunks seems reasonable since we don't use those chunks at all.

Oh, but that's actually not what's causing us to fail, that only causes a warning. With PNGDecoder:5 for mozlog:

E/PNGDecoder libpng error: g[BD][35][81]: invalid chunk type

And if you -f force pngcheck to continue you get

invalid chunk name "g?5?" (67 ffffffbd 35 ffffff81)
chunk g?5? at offset 0x092a3, length 942567534: EOF while reading data

Summary: PNG image with bad CRC is not loaded in Firefox. Chrome ignores error and displays image → PNG image with invalid chunk type is not loaded in Firefox. Chrome ignores error and displays image

Our png decoder works something like like "decode until the end of all the data then complete". For it to accept this file we would need to change it to "did we decode the image data expected based on the header, then stop reading", which is not trivial (probably not a huge refactoring, but not trivial).

:aosmond, can you comment to the bug?

Flags: needinfo?(aosmond)
Severity: -- → S3
Flags: needinfo?(aosmond)
See Also: → 1848544
See Also: → 1873422
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: