ref: 2157d8fa6f7e12063ca166476ed2223d24234db7
parent: 67697d0076cbd2e59ee22c665b2ee792ef5b54ae
author: Ben Wagner <[email protected]>
date: Tue Apr 24 06:29:19 EDT 2018
[base] Avoid undefined behaviour in lcd filtering code (#53727). * src/base/ftlcdfil.c (ft_lcd_filter_fir, _ft_lcd_filter_legacy): Ensure `height > 0'.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2018-04-24 Ben Wagner <[email protected]>
+
+ [base] Avoid undefined behaviour in lcd filtering code (#53727).
+
+ * src/base/ftlcdfil.c (ft_lcd_filter_fir, _ft_lcd_filter_legacy):
+ Ensure `height > 0'.
+
2018-04-22 Werner Lemberg <[email protected]>
* src/base/ftoutln.c (FT_Outline_Decompose): Improve error tracing.
--- a/src/base/ftlcdfil.c
+++ b/src/base/ftlcdfil.c
@@ -77,7 +77,7 @@
/* take care of bitmap flow */
- if ( pitch > 0 )
+ if ( pitch > 0 && height > 0 )
origin += pitch * (FT_Int)( height - 1 );
/* horizontal in-place FIR filter */
@@ -192,7 +192,7 @@
/* take care of bitmap flow */
- if ( pitch > 0 )
+ if ( pitch > 0 && height > 0 )
origin += pitch * (FT_Int)( height - 1 );
/* horizontal in-place intra-pixel filter */