shithub: freetype+ttf2subf

Download patch

ref: f2e7f1e1dd5452f915759e918a91c803f03bb8aa
parent: 21c32b08d5dfb015b49f0fa245dd264aaedba4a0
author: suzuki toshiya <[email protected]>
date: Tue Jul 30 09:32:57 EDT 2013

2013-07-30  Behdad Esfahbod  <[email protected]>

	Prevent division by zero by a transparent color.

	* src/base/ftbitmap.c (ft_gray_for_premultiplied_srgb_bgra):
	Return 0 immediately, when alpha channel is zero.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2013-07-30  Behdad Esfahbod  <[email protected]>
+
+	Prevent division by zero by a transparent color.
+
+	* src/base/ftbitmap.c (ft_gray_for_premultiplied_srgb_bgra):
+	Return 0 immediately, when alpha channel is zero.
+
 2013-07-25  Behdad Esfahbod  <[email protected]>
 
 	Add FT_FACE_FLAG_COLOR and FT_HAS_COLOR.
--- a/src/base/ftbitmap.c
+++ b/src/base/ftbitmap.c
@@ -385,6 +385,10 @@
     FT_Long  l;
 
 
+    /* Short-circuit transparent color to avoid div-by-zero. */
+    if (!a)
+      return 0;
+
     /*
      * Luminosity for sRGB is defined using ~0.2126,0.7152,0.0722
      * coefficients for RGB channels *on the linear colors*.