---------- Forwarded message ----------
From: Kai-Uwe Behrmann <beku@users.sf.net>
Date: Thu, Apr 24, 2014 at 1:20 PM
Subject: [libpng:bugs] #207 libpng-1.6.x is unable to use some libkdcraw-4.10.2 profiles
To: "[libpng:bugs]" <207@bugs.libpng.p.re.sf.net>


The ICC spec has a history. Spec ICC.1:2001-04 says nothing about a requirement of byte padding as is checked in the mentioned libpng code: "if (profile_length & 3)". Many widely distributed profiles originate from those version ICC 2.x times. See: http://www.color.org/ICC_Minor_Revision_for_Web.pdf Section 6.1.1.

So a argument of invalid profiles is not correct. libpng would have to check for (icc_version >= 4 && profile_length &3) to detect a real invalid profile.

We have many projects in Linux land which still distribute those old profiles for reasons of steadiness and because they are widely used already. Changing those profiles here and then will increase computational costs and decrease precission, because of unnecessary conversions.

Please reopen this bug.


---

** [bugs:#207] libpng-1.6.x is unable to use some libkdcraw-4.10.2 profiles**

**Status:** closed-invalid
**Group:** libpng_code
**Created:** Sun May 05, 2013 04:16 PM UTC by Andreas Huettel
**Last Updated:** Sun May 05, 2013 10:36 PM UTC
**Owner:** Glenn Randers-Pehrson

This is a clone of https://bugs.gentoo.org/show_bug.cgi?id=466798
Quoting from the bug report:

Saving a file into png format from `showfoto` (part of digikam) fails with error "libpng error: profile 'icc': 1B0Ah: invalid length"
It was working with libpng:1.5

replacing
/usr/share/apps/libkdcraw/profiles/srgb-d65.icm
with
/usr/share/apps/libkdcraw/profiles/srgb.icm
work.

Both files are from kde-base/libkdcraw-4.10.2

the size seem to be correctly reported (3rd and 4th byte in file)
0x1B0A == 6922
-rw-r--r-- 1 root root 6922  1 mar 08.01 /usr/share/apps/libkdcraw/profiles/srgb-d65.icm

iccexamin (and opening the files with an hex editor) seem to confirm both profiles are ok, so not a bug for libkdcraw.

the bug seem to be in libpng being overzealous, see the following function from png.c

png_icc_check_length(png_const_structrp png_ptr, png_colorspacerp colorspace,
   png_const_charp name, png_uint_32 profile_length)
{
   if (profile_length < 132)
      return png_icc_profile_error(png_ptr, colorspace, name, profile_length,
         "too short");

   if (profile_length & 3)
      return png_icc_profile_error(png_ptr, colorspace, name, profile_length,
         "invalid length");

   return 1;
}


---

Sent from sourceforge.net because you indicated interest in <https://sourceforge.net/p/libpng/bugs/207/>

To unsubscribe from further messages, please visit <https://sourceforge.net/auth/subscriptions/>