Opened 10 years ago

Closed 10 years ago

#5441 closed defect (fixed)

png_profile.py tests fail with libpng 1.6

Reported by: Even Rouault Owned by: cleo
Priority: normal Milestone:
Component: GDAL_Raster Version: svn-trunk
Severity: normal Keywords:
Cc:

Description

With libpng 1.6, we get the following failure :

  TEST: png_copy_icc ... ERROR 1: libpng: profile 'ICC Profile': 1B0Ah: invalid length
fail (blowup)
Traceback (most recent call last):
  File "../pymod/gdaltest_python2.py", line 42, in run_func
    result = func()
  File "png_profile.py", line 69, in png_copy_icc
    md = ds2.GetMetadata("COLOR_PROFILE")
AttributeError: 'NoneType' object has no attribute 'GetMetadata'
  TEST: png_copy_options_icc ... ERROR 1: libpng: profile 'ICC Profile': 1B0Ah: invalid length
fail (blowup)
Traceback (most recent call last):
  File "../pymod/gdaltest_python2.py", line 42, in run_func
    result = func()
  File "png_profile.py", line 149, in png_copy_options_icc
    md = ds2.GetMetadata("COLOR_PROFILE")
AttributeError: 'NoneType' object has no attribute 'GetMetadata'

The failure is emitted by png_icc_check_length in png.c that checks that the profile length is a multiple of 4, but the sample data length is 6922.

Attachments (2)

sRGB.icc (6.8 KB ) - added by cleo 10 years ago.
sRGB.2.icc (592 bytes ) - added by cleo 10 years ago.

Download all attachments as: .zip

Change History (8)

by cleo, 10 years ago

Attachment: sRGB.icc added

comment:1 by cleo, 10 years ago

This profile was created by lcms. The profile itself is a multiple of 4. But it appears that comments at the end of the profile are not restricted in this manner. I'm betting this will be an issue for many libraries using libpng.

I posted another profile with the comment padded.

comment:2 by Even Rouault, 10 years ago

This still does not work. The message is a bit different this time. It seems that the profile contains its length somewhere, but the declared length wouldn't match the actual length (as far as I can understand...)

 TEST: png_copy_icc ... ERROR 1: libpng: profile 'ICC Profile': 1B0Ah: length does not match profile
fail (blowup)
Traceback (most recent call last):
  File "../pymod/gdaltest_python2.py", line 42, in run_func
    result = func()
  File "png_profile.py", line 69, in png_copy_icc
    md = ds2.GetMetadata("COLOR_PROFILE")
AttributeError: 'NoneType' object has no attribute 'GetMetadata'
  TEST: png_copy_options_icc ... ERROR 1: libpng: profile 'ICC Profile': 1B0Ah: length does not match profile
fail (blowup)
Traceback (most recent call last):
  File "../pymod/gdaltest_python2.py", line 42, in run_func
    result = func()
  File "png_profile.py", line 149, in png_copy_options_icc
    md = ds2.GetMetadata("COLOR_PROFILE")
AttributeError: 'NoneType' object has no attribute 'GetMetadata'

comment:3 by cleo, 10 years ago

I'll generate a new one directly from lcms and ensure it outputs the right size. I'll post back later when I have some time. I'll look into removing the comment all together. The rest seems to be the right size.

comment:4 by Even Rouault, 10 years ago

Hi cleo, any update on this ?

comment:5 by cleo, 10 years ago

Been really busy lately. I'll try and get one uploaded today.

by cleo, 10 years ago

Attachment: sRGB.2.icc added

comment:6 by Even Rouault, 10 years ago

Resolution: fixed
Status: newclosed

Thanks !

trunk r27374 "Update sRGB.icc to be compatible with libpng 1.6 (#5441, patch by cleo)"

Note: See TracTickets for help on using tickets.