From 5cbcab183a78ca84d726a876a14223923ba24970 Mon Sep 17 00:00:00 2001 From: Anuj Verma Date: Wed, 1 Jul 2020 08:36:29 +0530 Subject: [PATCH] * src/sdf/ftsdf.c (get_min_distance_line): Minor bug --- [GSoC]ChangeLog | 5 +++++ src/sdf/ftsdf.c | 14 +++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/[GSoC]ChangeLog b/[GSoC]ChangeLog index 7a5171edc..c61d47281 100644 --- a/[GSoC]ChangeLog +++ b/[GSoC]ChangeLog @@ -1,3 +1,8 @@ +2020-07-01 Anuj Verma + + * src/sdf/ftsdf.c (get_min_distance_line): First check + pointer before using or dereferencing them. + 2020-06-30 Anuj Verma * src/sdf/ftsdf.c: Avoid parentheses if there is only diff --git a/src/sdf/ftsdf.c b/src/sdf/ftsdf.c index a95ae231f..4ec5bdc03 100644 --- a/src/sdf/ftsdf.c +++ b/src/sdf/ftsdf.c @@ -1014,9 +1014,9 @@ FT_Error error = FT_Err_Ok; - const FT_Vector a = line->start_pos; - const FT_Vector b = line->end_pos; - const FT_Vector p = point; + FT_Vector a; /* start position */ + FT_Vector b; /* end position */ + FT_Vector p; /* current point */ FT_26D6_Vec line_segment; /* `b' - `a'*/ FT_26D6_Vec p_sub_a; /* `p' - `a' */ @@ -1025,8 +1025,8 @@ FT_16D16 factor; /* factor of the nearest point */ FT_26D6 cross; /* used to determine sign */ - FT_16D16_Vec nearest_point; /* point on the line nearest to `point' */ - FT_16D16_Vec nearest_vector; /* `p' - `nearest_point' */ + FT_16D16_Vec nearest_point; /* `point_on_line' */ + FT_16D16_Vec nearest_vector; /* `p' - `nearest_point' */ if ( !line || !out ) { @@ -1040,6 +1040,10 @@ goto Exit; } + a = line->start_pos; + b = line->end_pos; + p = point; + line_segment.x = b.x - a.x; line_segment.y = b.y - a.y;