Skip to content

Fixes for reading an .ico file containing unsupported compressed icons

Maarten requested to merge madebr/gdk-pixbuf:ico-with-pngs into master
  • The first patch makes sure the entry of an unsupported icon never used by using temporary variables
  • The second patch detects a PNG embedded icon, adds a TODO there, and rejects the icon.
  • The third patch uses the already-read data for pixels. This happens when a previously read icon is used because a later one is unsupported/invalid.

Fixes #227

I didn't add a new test case, but one can be generated by the following shell script:

#!/bin/sh

set -ex

files=
ico_dims="16x16 32x32 64x64 128x128"
png_dims="256x256"

ext=.ico
for dim in $ico_dims; do
  convert tests/test-image.png -resize $dim -extent $dim /tmp/test-image-$dim$ext
  files="$files /tmp/test-image-$dim$ext"
done

ext=.png
for dim in $png_dims; do
  convert tests/test-image.png -resize $dim -extent $dim /tmp/test-image-$dim$ext
  files="$files /tmp/test-image-$dim$ext"
done

convert $files /tmp/test-images.ico

I verified this fix by using LD_LIBRARY_PATH + eog.

Merge request reports

Loading