Created attachment 346282 [details] debug area 50003 digikam-50003.log 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 >usr>src$ showfoto Fontconfig warning: "/etc/fonts/conf.d/50-user.conf", line 9: reading configurations from ~/.fonts.conf is deprecated. "/org/freedesktop/UDisks2/drives/SAMSUNG_SSD_830_Series_S0XYNEAC664966" : property "Drive" does not exist "/org/freedesktop/UDisks2/drives/WDC_WD1002FAEX_00Y9A0_WD_WCAW30075681" : property "Drive" does not exist "/org/freedesktop/UDisks2/drives/WDC_WD1002FAEX_00Y9A0_WD_WCAW30058295" : property "Drive" does not exist "/org/freedesktop/UDisks2/drives/Generic_Ultra_HS_SD_2fMMC_000000264001" : property "Drive" does not exist "/org/freedesktop/UDisks2/drives/Kindle_Internal_Storage_B0241502243506JP" : property "Drive" does not exist "/org/freedesktop/UDisks2/drives/ASUS____DRW_24B3LT_B4D0CL324524" : property "Drive" does not exist "/org/freedesktop/UDisks2/drives/SAMSUNG_SSD_830_Series_S0XXNEAC626599" : property "Drive" does not exist showfoto(25572)/digikam (core) Digikam::ThumbnailCreator::createThumbnail: Cannot create thumbnail for "/home/vivo/docs/NIKON/2013/20130420-test/work/EditorWindow-k19287.digikamtempfile.png" showfoto(25572)/digikam (core) Digikam::ThumbnailCreator::load: Thumbnail is null for "/home/vivo/docs/NIKON/2013/20130420-test/work/EditorWindow-k19287.digikamtempfile.png" showfoto(25572)/digikam (core) Digikam::ThumbnailCreator::createThumbnail: Cannot create thumbnail for "/home/vivo/docs/NIKON/2013/20130420-test/work/EditorWindow-Ly7331.digikamtempfile.png" showfoto(25572)/digikam (core) Digikam::ThumbnailCreator::load: Thumbnail is null for "/home/vivo/docs/NIKON/2013/20130420-test/work/EditorWindow-Ly7331.digikamtempfile.png" showfoto(25572)/digikam (core) Digikam::FileSaveOptionsBox::discoverFormat: Using fallback format 0 showfoto(25572)/digikam (core) Digikam::FileSaveOptionsBox::discoverFormat: Using fallback format 0 showfoto(25572)/digikam (core) Digikam::FileSaveOptionsBox::discoverFormat: Using fallback format 0 libpng error: profile 'icc': 1B0Ah: invalid length showfoto(25572)/digikam (core) Digikam::EditorCore::slotImageSaved: error saving image ' /home/vivo/docs/NIKON/2013/20130420-test/work/EditorWindow-w25572.digikamtempfile.png emerge --info Portage 2.2.0_alpha173 (default/linux/amd64/13.0, gcc-4.8.0, glibc-2.15-r3, 3.9.0-rc7-monfi x86_64) ================================================================= System uname: Linux-3.9.0-rc7-monfi-x86_64-Intel-R-_Core-TM-_i7-3770K_CPU_@_3.50GHz-with-gentoo-2.2 KiB Mem: 11985064 total, 4400232 free KiB Swap: 16777208 total, 16777208 free Timestamp of tree: Mon, 22 Apr 2013 08:30:01 +0000 ld ld di GNU (GNU Binutils) 2.23.1 distcc 3.1 x86_64-pc-linux-gnu [enabled] ccache version 3.1.9 [disabled] app-shells/bash: 4.2_p45 dev-java/java-config: 2.2.0 dev-lang/python: 2.7.3-r3, 3.3.0-r1 dev-util/ccache: 3.1.9 dev-util/cmake: 2.8.11_rc2-r1::kde dev-util/pkgconfig: 0.28 sys-apps/baselayout: 2.2 sys-apps/openrc: 0.11.8 sys-apps/sandbox: 2.6-r1 sys-devel/autoconf: 2.13, 2.69 sys-devel/automake: 1.10.3, 1.11.6, 1.13.1 sys-devel/binutils: 2.23.1 sys-devel/gcc: 4.8.0 sys-devel/gcc-config: 1.8 sys-devel/libtool: 2.4.2 sys-devel/make: 3.82-r4 sys-kernel/linux-headers: 3.8 (virtual/os-headers) sys-libs/glibc: 2.15-r3 Repositories: gentoo sabayon sabayon-distro qt x11 kde mysql vivovl digikam systemd-love ACCEPT_KEYWORDS="amd64 ~amd64" ACCEPT_LICENSE="*" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-O2 -march=corei7-avx -pipe -frecord-gcc-switches -mno-bmi2 -mno-avx2 -mno-lzcnt -mrdrnd --param=l1-cache-size=32" CHOST="x86_64-pc-linux-gnu" CONFIG_PROTECT="/etc /etc/conf.d /etc/init.d /usr/share/config /usr/share/config/kdm /usr/share/gnupg/qualified.txt /usr/share/polkit-1/actions /usr/share/themes/oxygen-gtk/gtk-2.0 /usr/share/themes/oxygen-gtk/gtk-3.0 /var/lib/hsqldb" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.5/ext-active/ /etc/php/cgi-php5.5/ext-active/ /etc/php/cli-php5.5/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/skel /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c" CXXFLAGS="-O2 -march=corei7-avx -pipe -frecord-gcc-switches -mno-bmi2 -mno-avx2 -mno-lzcnt -mrdrnd --param=l1-cache-size=32 -fvisibility-inlines-hidden -fabi-version=6 -ffor-scope -fstrict-enums -fuse-cxa-atexit" DISTDIR="/g/distfiles" EMERGE_DEFAULT_OPTS="--ask-enter-invalid --quiet-build=y --buildpkg-exclude=x11-drivers/nvidia-drivers --buildpkg-exclude=sys-power/bbswitch --buildpkg-exclude=app-emulation/virtualbox-modules --buildpkg-exclude=sys-fs/aufs3" FCFLAGS="-O2 -pipe" FEATURES="assume-digests binpkg-logs clean-logs compress-build-logs compressdebug config-protect-if-modified distcc distlocks ebuild-locks fail-clean fixlafiles installsources merge-sync news noinfo notitles parallel-fetch parallel-install sandbox sfperms skiprocheck splitdebug strict test-fail-continue unknown-features-warn unmerge-logs unmerge-orphans xattr" FFLAGS="-O2 -pipe" GENTOO_MIRRORS="ftp://mirrors.tera-byte.com/pub/gentoo ftp://ftp.spline.inf.fu-berlin.de/mirrors/gentoo/ http://archive.mmu.edu.my/gentoo rsync://gentoo.bloodhost.ru/gentoo-distfiles ftp://gentoo.mirrors.tds.net/gentoo ftp://ftp.halifax.rwth-aachen.de/gentoo/ rsync://mirror.neolabs.kz/gentoo http://ftp.gentoo.bg/ http://ftp.cc.uoc.gr/mirrors/linux/gentoo/ ftp://ftp.cc.uoc.gr/mirrors/linux/gentoo/" INSTALL_MASK=" /usr/lib64/elektra/*.la /usr/lib64/libelektra*.la /usr/lib64/libo{{,sp}grove,style}.la /lib/udev/rules.d/45-Argyll.rules /usr/lib64/terminfo/[0-9] /usr/src/debug /usr/lib64/debug/ " LANG="it_IT.UTF-8" LC_ALL="it_IT.UTF-8" LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,--build-id" MAKEOPTS="-j3" PKGDIR="/g/binhost/" PORTAGE_COMPRESS_FLAGS="-3" PORTAGE_CONFIGROOT="/" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/g/portage" PORTDIR_OVERLAY="/g/ovl/for-gentoo /g/ovl/sabayon /g/ovl/qt /g/ovl/x11 /g/ovl/kde /g/ovl/mysql /g/ovl/tmp /g/ovl/digikam /g/ovl/systemd-love" SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage" USE="X a52 aac accessibility acl acpi aiglx aim alsa amd64 artswrappersuid audiofile avahi bash-completion berkdb bidi bluetooth bzip2 cairo cdda cddb cdr cjk cli cpudetection cracklib crypt cups cxx dbus dga dri dts dv dvb dvd dvdr dvdread dvi efi egl fame fat ffmpeg firefox flac foomatic-db fortran freetype gcj gdbm gif gimpprint gles2 gmp gnutls gphoto2 gpm gsm gtk hfs iconv icq ieee1394 imap inotify ipod ipv6 irc irda jabber jack jfs joystick kdeenablefinal kdehiddenvisibility kerberos lame lcd libnotify live lm_sensors lzo mail matroska mjpeg mmx modules mozdevelop mp3 mp3rtp msn mudflap multilib musepack musicbrainz ncurses network nls nptl nsplugin ntfs ogg openal openexr opengl openmp pam pcmcia pcre pda perl png policykit ppds pulseaudio python qt3support qt4 rar rdesktop readline reiserfs rss scanner sdl session slp smpeg speex sse sse2 ssl startup-notification stream svg sysfs systemd tcpd theora tiff udev unicode usb v4l v4l2 visualization wifi wmf x264 xattr xcb xfs xine xinerama xpm xprint xulrunner xvid xvmc yahoo zeroconf zlib" ABI_X86="64" ALSA_CARDS="emu10k1x darla20 darla24 emu10k1 gina20 gina24 hdsp hdspm ice1712 indigo indigoio layla20 layla24 mia mixart mona pcxhr rme32 rme96 sb16 sbawe sscape usbusx2y vx222 usb-usx2y" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" APACHE2_MPMS="prefork" CALLIGRA_FEATURES="krita braindump flow stage words sheets" CAMERAS="agfa_cl20 casio_qv dimagev dimera3500 kodak_dc120 kodak_dc210 kodak_dc240 kodak_dc3200 kodak_ez200 konica_qm150 panasonic_coolshot panasonic_dc1000 panasonic_dc1580 panasonic_l859 polaroid_pdc320 polaroid_pdc640 polaroid_pdc700 ricoh_g3 sipix_blink sipix_blink2 sipix_web2 sony_dscf1 sony_dscf55 toshiba_pdrm11 adc65 aox barbie canon clicksmart310 digigr8 digita directory enigma13 fuji gsmart300 hp215 iclick jamcam jd11 konica largan lg_gsm mars mustek pccam300 pccam600 ptp2 ricoh samsung sierra smal sonix soundvision spca50x sq905 stv0674 stv0680 sx330z template" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" DRACUT_MODULES="caps cifs dmsquash-live livenet mdraid nfs ssh-client syslog systemd" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="evdev void" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer nlpsolver pdfimport scripting-beanshell scripting-javascript wiki-publisher" LINGUAS="it en en_US" LIRC_DEVICES="audio audio_alsa serial pctv" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-4" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7" QEMU_SOFTMMU_TARGETS="arm cris m68k microblaze mips mips64 mips64el mipsel ppc ppc64 ppcemb sh4 sh4eb sparc sparc64" QEMU_USER_TARGETS="arm x86_64" RUBY_TARGETS="ruby18 ruby19" USERLAND="GNU" VIDEO_CARDS="fbdev vesa radeonhd r300 r600 intel modesetting radeon" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account" USE_PYTHON="2.7" Unset: CPPFLAGS, CTARGET, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_RSYNC_EXTRA_OPTS
We cannot do much about this... Please file a bug on bugs.kde.org and link to it here for tracking.
Which digikam version is this?
oops, this is from git, forgot to mention it before. BTW the problem is still present with libpng-1.6.2, will look soon at it and try a patch
temporary workarond rename /usr/share/apps/libkdcraw/profiles/srgb-d65.icm the program will complain but save the png
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; } I don't know where the test (profile_length & 3) come from but it's failing, the function is undocumented and the git repository of libpng seem to be a dump for tarballs so my debugging stop here waiting for instructions
Opened libpng bug with information from here
for completeness: Table 17 — Profile header fields of section 7.2 in http://www.color.org/specification/ICC1v43_2010-12.pdf describes the first 128 bytes of an icc file
ICC profiles are required to have a length which is a multiple of 4, so the profile in question is broken. (See 7.1.2(c) in the spec and "NOTE 1" that follows it then read 7.2.2 - the length includes the pad bytes.) I believe there was (and maybe is) an app that was writing text strings at the end of the profile and, if the text string was not a multiple of 4 in length, it would produce a bad profile. Those profiles are easy to fix - just pad the string with \0 - but other bugs where the profile length is calculated wrong may result in serious errors. (libpng does go on to validate the length, but when the length is detectably broken at the start it simply rejects the profile.) This is a benign error on read and the profile will be ignored (along with any other colorspace information in the PNG) but on write it gets converted into an application error - we don't want to write PNGs with detectably broken profiles, something else may crash! The KDE upstream need to fix the profile, it should be easy.
Back to team then... :]
profiles not aligned to 4 byte (~2100 pkg installed, not complete): 154323 app-office/calligra (/usr/share/color/icc/krita/lcmsxyzi.icm) 827 app-office/calligra (/usr/share/color/icc/krita/scRGB.icm) 154326 app-office/calligra (/usr/share/color/icc/krita/lcmslabi.icm) 28202 media-libs/lcms (/usr/share/lcms/profiles/sRGBSpac.icm) 6922 kde-base/libkdcraw (/usr/share/apps/libkdcraw/profiles/srgb-d65.icm)
another note all these profiles have been created by lcms 2.1.0 and 2.3.0 under some microsoft platform. lcms 2.4.0 is released and it would interesting to see if it also generate (or translate) profiles which are not aligned. Marti M. hope you can see this
Hi, that's Marti, the author of lcms. I've taken a look on that and those bogus profiles comes from diverse origins. The "2.1" and "2.3" version stamp you see in the profile does *not* refer to littlecms library, but to the ICC spec they are supposed to follow. Current ICC spec is 4.3, so go figure how old those profiles are. I can identify lcmslab and lcmsxyz as being prototypes created by myself about 15 years ago, in the old days of lcms 1.1 I would just discard those profiles as they are actually useless. For the remaining ones, I searching in my profile collection I can find same file names but with size multiple of 4. I wonder if any spare bytes have been added by I don't know which magic process. Otherwise, the check is fine but probably too restrictive for untrusted environments and too permissive if you want to take security into account. The profile header contains the expected length, I would check that field and probably the MD5 id if you want to make sure the profile have not been stamped.
Gentooers what about the following plan? 1) fix profiles from lcms:0, put them in $FILESDIR, or even better remove them at all at install phase. Most (but far from all) application use lcms:2 nowadays it should be lcms-1.19-r1 (current and stable is 1.19-r0) 2) app-office/calligra should be fixed upstream by next release but media-libs/libpng-1.6* could become stable before them. Profiles should be fixed right now, without waiting for upstream with a temporary solution. Sadly some profiles are big and don't fit well^W at all in $FILESDIR. This leaves us two option, first is to provide an additional package, second is to fix them on the fly: in case you decide to fix on the fly at install phase here there is a short snipper of bash code that can help: # pad an icc profile to 4bytes PROFILENAME="srgb-d65.icm" oldsize=$(stat --printf='%s' "${PROFILENAME}") newsize=$(( (oldsize +3 ) / 4 * 4 )) if [[ $oldsize != $newsize ]] ; then # first pad the file for i in $(seq $(( newsize - oldsize)) ) ; do echo -ne \\00 >> "${PROFILENAME}" done # then replace the size in the header (the first 4 bytes) hexnewsize=$(printf '%08X\n' ${newsize}) hexnewsize=$(echo ${hexnewsize} | sed -e 's:..:\\x\0:g') sed -e '1s:^....:'${hexnewsize}':' -i "${PROFILENAME}" fi be warned that sed MUST support the sintax 's/..../\x0D\x0A\x4D\x53\x48/' all gentoo provided should but please check 3) kde-base/libkdcraw same as calligra but without the size problem, the only profile affected is small
Safer version, use dd instead of sed and replace original file only after all operations are done, an even safer version would die() on errors pad_icc() { local PROFILENAME="$1" local oldsize=$(stat --printf='%s' "${PROFILENAME}") local newsize=$(( (oldsize +3 ) / 4 * 4 )) local hexnewsize if [[ $oldsize != $newsize ]] ; then hexnewsize=$(printf '%08X\n' ${newsize}) hexnewsize=$(echo ${hexnewsize} | sed -e 's:..:\\x\0:g') # write the new size (4 byte file) echo -ne ${hexnewsize} > "${PROFILENAME}".new # now append the original profile w/o the first 4 byte dd if="${PROFILENAME}" ibs=4 skip=1 >> "${PROFILENAME}".new # then pad to the wanted size for i in $(seq $(( newsize - oldsize)) ) ; do echo -ne \\00 >> "${PROFILENAME}".new done # finally move to the original mv "${PROFILENAME}".new "${PROFILENAME}" fi } pad_icc profiles/srgb-d65.icm
libkdcraw should be fixed in next version, calligra/krita has a bug open@ https://bugs.kde.org/show_bug.cgi?id=319579
Francesco, how about you push your libkdcraw commit into KDE/4.10 branch too? Then it would be fixed in 4.10.5 ...
humm, no expert in backporting, but if the git cherry pick magic has been done right it would be commit "92a57e163222ef9ee072964eb5cad92d9567a24d" in KDE/4.10
(In reply to Francesco Riosa from comment #17) > humm, no expert in backporting, but if the git cherry pick magic has been > done right it would be commit "92a57e163222ef9ee072964eb5cad92d9567a24d" in > KDE/4.10 this is fixed now? can we close the bug? *libkdcraw-4.10.5 (02 Jul 2013) 02 Jul 2013; Johannes Huber <johu@gentoo.org> +libkdcraw-4.10.5.ebuild: Version bump KDE SC 4.10.5 libpng 1.6.3 going stable in 4 weeks
(In reply to Samuli Suominen from comment #18) > (In reply to Francesco Riosa from comment #17) > > humm, no expert in backporting, but if the git cherry pick magic has been > > done right it would be commit "92a57e163222ef9ee072964eb5cad92d9567a24d" in > > KDE/4.10 > > this is fixed now? can we close the bug? > > *libkdcraw-4.10.5 (02 Jul 2013) > > 02 Jul 2013; Johannes Huber <johu@gentoo.org> +libkdcraw-4.10.5.ebuild: > Version bump KDE SC 4.10.5 > It should be fixed, yes. > libpng 1.6.3 going stable in 4 weeks It is very likely that 4.10.5 will be stabilised before then so there shouldn't be any problems.
yes