ref: 580c94d8f71d08066d67bc5d8a2f2033d62f9317
parent: 4b97ab98a8e90ae5403058b73c345974247bf01e
author: Werner Lemberg <[email protected]>
date: Wed Jul 25 03:03:07 EDT 2018
Fix minor ASAN run-time warnings. * src/base/ftutil.c (ft_mem_alloc, ft_mem_realloc): Only call `FT_MEM_ZERO' if we actually have a buffer. (ft_mem_dup): Only call `ft_memcpy' if we actually have a buffer.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2018-07-25 Werner Lemberg <[email protected]>
+
+ Fix minor ASAN run-time warnings.
+
+ * src/base/ftutil.c (ft_mem_alloc, ft_mem_realloc): Only call
+ `FT_MEM_ZERO' if we actually have a buffer.
+ (ft_mem_dup): Only call `ft_memcpy' if we actually have a buffer.
+
2018-07-24 Alexei Podtelezhnikov <[email protected]>
[build] Fortify dllexport/dllimport attributes (#53969,#54330).
--- a/src/base/ftutil.c
+++ b/src/base/ftutil.c
@@ -54,7 +54,7 @@
FT_Error error;
FT_Pointer block = ft_mem_qalloc( memory, size, &error );
- if ( !error && size > 0 )
+ if ( !error && block && size > 0 )
FT_MEM_ZERO( block, size );
*p_error = error;
@@ -101,7 +101,7 @@
block = ft_mem_qrealloc( memory, item_size,
cur_count, new_count, block, &error );
- if ( !error && new_count > cur_count )
+ if ( !error && block && new_count > cur_count )
FT_MEM_ZERO( (char*)block + cur_count * item_size,
( new_count - cur_count ) * item_size );
@@ -185,7 +185,7 @@
FT_Pointer p = ft_mem_qalloc( memory, (FT_Long)size, &error );
- if ( !error && address )
+ if ( !error && address && size > 0 )
ft_memcpy( p, address, size );
*p_error = error;