[Pkg-fonts-devel] Bug#646619: fontforge: Crash when reading optimized png files
Package: fontforge
Version: 0.0.20110222-3
Severity: normal
Tags: patch
User: ubuntu-devel@lists.ubuntu.com
Usertags: origin-ubuntu precise ubuntu-patch
In Ubuntu, the attached patch was applied to prevent a crash when reading optimized png files.
Ubuntu routinely runs optipng on installed png files, and that revealed a bug in fontforge's built-in png reader code. This probably isn't super important for Debian, as you don't run optipng, but it appears to be a real bug and would let us get in sync again if it was applied.
I've also forwarded this patch to the fontforge mailing list.
Thanks for considering the patch.
-- System Information:
Debian Release: wheezy/sid
APT prefers oneiric-updates
APT policy: (500, 'oneiric-updates'), (500, 'oneiric-security'), (500, 'oneiric')
Architecture: i386 (i686)
Kernel: Linux 3.0.0-12-generic (SMP w/4 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
diff -Nru fontforge-0.0.20110222/debian/patches/902_fix_optipng_reads.diff fontforge-0.0.20110222/debian/patches/902_fix_optipng_reads.diff
--- fontforge-0.0.20110222/debian/patches/902_fix_optipng_reads.diff 1969-12-31 19:00:00.000000000 -0500
+++ fontforge-0.0.20110222/debian/patches/902_fix_optipng_reads.diff 2011-10-25 14:25:46.000000000 -0400
@@ -0,0 +1,21 @@
+Description: If trans_alpha is NULL (likely due to optimized png), don't crash
+Author: Michael Terry <michael.terry@canonical.com>
+Forwarded: yes
+Bug-Ubuntu: https://launchpad.net/bugs/805752
+
+Index: fontforge-0.0.20110222/gutils/gimagereadpng.c
+===================================================================
+--- fontforge-0.0.20110222.orig/gutils/gimagereadpng.c 2011-10-25 14:17:10.856004364 -0400
++++ fontforge-0.0.20110222/gutils/gimagereadpng.c 2011-10-25 14:17:14.640004404 -0400
+@@ -282,9 +282,9 @@
+ (trans_color->green>>8),
+ (trans_color->blue>>8));
+ else if ( base->image_type == it_mono )
+- base->trans = trans_alpha[0];
++ base->trans = trans_alpha ? trans_alpha[0] : 0;
+ else
+- base->clut->trans_index = base->trans = trans_alpha[0];
++ base->clut->trans_index = base->trans = trans_alpha ? trans_alpha[0] : 0;
+ }
+
+ row_pointers = galloc(_png_get_image_height(png_ptr,info_ptr)*sizeof(png_bytep));
diff -Nru fontforge-0.0.20110222/debian/patches/series fontforge-0.0.20110222/debian/patches/series
--- fontforge-0.0.20110222/debian/patches/series 2011-06-05 08:14:54.000000000 -0400
+++ fontforge-0.0.20110222/debian/patches/series 2011-10-25 14:16:21.000000000 -0400
@@ -5,3 +5,4 @@
027_catch_ctrl-c_signal.diff
900_debian_HelpDir_path.diff
901_ld_as_needed.diff
+902_fix_optipng_reads.diff
Reply to: