Hi Werner,
Thanks for doing the additions. The code is looking much cleaner now : D

The updated code is working fine when we are using the `FT2_DEBUG'
environment
variable with tags(-v / -t / -vt), but without these tags I am getting
corrupted memory
issue with the `features_buf' char array in
`src/base/ftdebug.c(ft_log_handler)' on both
Ubuntu and Windows.

In `src/base/ftdebug.c:492' we are updating the `bufp' pointer to point to
(features_length-1) th
position but that would point to a wrong memory address if there are no
additions in `features_length'
variable.
I am attaching a patch file with a fix : )

Also, the logic to handle the custom log handler is not present in `FT_LOG'
macro in
`include/freetype/internal/ftdebug.h', have you removed that feature, or
did you missed
to update it?

Thanks,
Priyesh

On Wed, Dec 2, 2020 at 6:58 PM Werner LEMBERG <w...@gnu.org> wrote:

>
> I've just pushed the branch 'logging' to the git repository that
> contains the Priyesh's GSoC project, with all commits beautified, and
> with many necessary additions.
>
> Please have a look!
>
>
>     Werner
>
diff --git a/builds/windows/ftdebug.c b/builds/windows/ftdebug.c
index f2a1ce2f4..389b9d8a9 100644
--- a/builds/windows/ftdebug.c
+++ b/builds/windows/ftdebug.c
@@ -500,9 +500,10 @@
       }
 
       if ( ft_component_flag || ft_timestamp_flag )
+      {
         ft_strncpy( features_buf, features, features_length );
-
-      bufp += features_length - 1;
+        bufp += features_length - 1;
+      }
 
       if ( ft_component_flag )
       {
diff --git a/src/base/ftdebug.c b/src/base/ftdebug.c
index 48bd52a92..c8340bbd2 100644
--- a/src/base/ftdebug.c
+++ b/src/base/ftdebug.c
@@ -487,9 +487,10 @@
       }
 
       if ( ft_component_flag || ft_timestamp_flag )
+      {
         ft_strncpy( features_buf, features, features_length );
-
-      bufp += features_length - 1;
+        bufp += features_length - 1;
+      }
 
       if ( ft_component_flag )
       {

Reply via email to