[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ft-devel] Avoid div-by-zero in color conversion code
From: |
Behdad Esfahbod |
Subject: |
[ft-devel] Avoid div-by-zero in color conversion code |
Date: |
Mon, 29 Jul 2013 18:38:18 -0400 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130623 Thunderbird/17.0.7 |
Werner,
Please apply this minor patch:
diff --git a/src/base/ftbitmap.c b/src/base/ftbitmap.c
index 975818e..fb09e00 100644
--- a/src/base/ftbitmap.c
+++ b/src/base/ftbitmap.c
@@ -384,6 +384,9 @@
FT_Long r = bgra[2];
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
Thanks,
--
behdad
http://behdad.org/
- [ft-devel] Avoid div-by-zero in color conversion code,
Behdad Esfahbod <=