Opened 10 years ago

Closed 10 years ago

Last modified 9 years ago

#3416 closed defect (fixed)

Win7 MSPaint Produces Screwy, Hard to Read PNG Files

Reported by: warmerdam Owned by: warmerdam
Priority: normal Milestone: 1.8.0
Component: GDAL_Raster Version: unspecified
Severity: normal Keywords: PNG
Cc:

Description

Graeme Hiebert and Dale Lutz have reported that Win7 MSPaint will sometimes produce hard to read PNG files like the attached one.

Attachments (1)

fme_l_blue_twitter_3.png (99.1 KB) - added by warmerdam 10 years ago.
Difficult to read png file.

Download all attachments as: .zip

Change History (3)

Changed 10 years ago by warmerdam

Attachment: fme_l_blue_twitter_3.png added

Difficult to read png file.

comment:1 Changed 10 years ago by warmerdam

Resolution: fixed
Status: newclosed

There is a "zero chunk" in this file starting at byte 0x46 with a zero length, and a chunk name of 0x00000000 but a proper crc checksum for this name.

00000030: 0500 0000 0970 4859 7300 000e c400 000e  .....pHYs.......
00000040: c401 952b 0e1b 0000 0000 0000 0000 2144  ...+..........!D
00000050: df1c 0000 ffa6 4944 4154 785e ecfd 0780  ......IDATx^....

The libpng code checks for chunk names with special characters and issues a fatal error. It also issues a fatal error if the chunk is unknown and has a zero high order bit on character one which apparently indicates it is a "critical chunk".

In order to read this file with GDAL I relaxed both items to be warnings and then it works fine. I have incorporated this change into trunk (r18808) though I'm personally a bit dubious about whether it is better to read this message or to just fail. It is fairly likely this "fix" will be lost in the next update from libpng.

comment:2 Changed 9 years ago by Even Rouault

r20023 /trunk/gdal/frmts/png/libpng/ (README pngrutil.c): Reapply change done in r18808 and lost when upgrading to latest libpng (#3416)

Note: See TracTickets for help on using tickets.