diff options
author | Ben Wagner <bungeman@google.com> | 2018-04-24 10:29:19 +0200 |
---|---|---|
committer | Werner Lemberg <wl@gnu.org> | 2018-04-24 10:29:19 +0200 |
commit | 2157d8fa6f7e12063ca166476ed2223d24234db7 (patch) | |
tree | a4a94df9710c34f1ad6fe22c3e19f2f7efa5713e | |
parent | 67697d0076cbd2e59ee22c665b2ee792ef5b54ae (diff) | |
download | freetype2-2157d8fa6f7e12063ca166476ed2223d24234db7.tar.gz |
[base] Avoid undefined behaviour in lcd filtering code (#53727).
* src/base/ftlcdfil.c (ft_lcd_filter_fir, _ft_lcd_filter_legacy):
Ensure `height > 0'.
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | src/base/ftlcdfil.c | 4 |
2 files changed, 9 insertions, 2 deletions
@@ -1,3 +1,10 @@ +2018-04-24 Ben Wagner <bungeman@google.com> + + [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 <wl@gnu.org> * src/base/ftoutln.c (FT_Outline_Decompose): Improve error tracing. diff --git a/src/base/ftlcdfil.c b/src/base/ftlcdfil.c index 5c38911a9..8d314df08 100644 --- 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 */ |