Failure to retrieve image resolution of PNGs with 'Units: Undefined' (clang from Xcode 4.6.3)
| Affects | Status | Importance | Assigned to | Milestone | |
|---|---|---|---|---|---|
| Inkscape |
Fix Released
|
Medium
|
su_v | ||
Bug Description
The attached patch allows to work around failure in Inkscape 0.91 and trunk to import certain kinds of PNG images / paste from clipboard correctly with image resolution take from file (default import setting). So far only known to affect builds on OS X 10.7.5 after upgrading Xcode from 4.3.2 to 4.6.3.
Known trigger:
Affected PNG images have 'Units: Undefined' in the output of ImageMagick's identify -verbose command.
Known limitation of patch:
The current patch is only in effect with more recent versions of libpng which support PNG_INCH_
Possibly cause:
Underlying issue is possibly a compiler bug (?) with clang from Xcode 4.6.3, triggered e.g. with -02, -O1, but apparently not with debug build -O0 -g. Might be related to libpng's typedef png_uint_32 (likely specific to OS/platform).
Affected compiler (Xcode 4.6.3, OS X 10.7.5):
$ clang --version
Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM 3.2svn)
Target: x86_64-
Thread model: posix
Observed symptoms:
With unpatched code (0.91, 0.91+devel):
* incorrect res_x (--> computed width is incorrect)
* erroneous (huge) res_y (--> computed height is close to zero)
* incorrect unit_type (1 (same as PNG_RESOLUTION_
Note:
The attached patch also includes debug messages for image resolutions of other image formats (helpful for debugging, but not essential for the workaround with clang from Xcode 4.6.3).
It is unknown to me whether newer versions of clang on later version of OS X or any clang version on other platforms are also affected.
Consistently reproduced, most recent with Inkscape 0.91+devel r14648 (Feb 12 2016), libpng 1.6.20.
=====
See also initial draft for report from Aug 18, 2015:
https:/
Related branches
- 1545319-fix-bitmap-import-debug-msgs-r14648.diff Edit (2.5 KiB, text/plain)
Patch (used successfully with local builds).
Could anyone using Clang on other operating systems test the patch? Thanks!
Tested on Xubuntu 15.10 (libpng-1.2.51) and Windows 7. No regression found with systems that are not affected by the bug.
Patch applied to the trunk rev. 14772 (with new debug function).