Commit 9d8e6c29801c95ca170578a209ba2308dd8efa99

Werner Lemberg 2018-06-16T10:11:58

* src/base/ftbitmap.c (FT_Bitmap_Blend): Avoid integer overflow.

diff --git a/ChangeLog b/ChangeLog
index 00def31..eab381a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2018-06-16  Werner Lemberg  <wl@gnu.org>
 
+	* src/base/ftbitmap.c (FT_Bitmap_Blend): Avoid integer overflow.
+
+2018-06-16  Werner Lemberg  <wl@gnu.org>
+
 	Add `FT_Bitmap_Blend' API.
 
 	Still missing: Support for negative bitmap pitch and subpixel offset
diff --git a/src/base/ftbitmap.c b/src/base/ftbitmap.c
index e848e66..be36dbd 100644
--- a/src/base/ftbitmap.c
+++ b/src/base/ftbitmap.c
@@ -901,8 +901,11 @@
     source_llx -= final_llx;
     source_lly -= final_lly;
 
-    target_llx -= final_llx;
-    target_lly -= final_lly;
+    if ( target->width && target->rows )
+    {
+      target_llx -= final_llx;
+      target_lly -= final_lly;
+    }
 
     /* set up target bitmap */
     if ( target->pixel_mode == FT_PIXEL_MODE_NONE )