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.
This commit is contained in:
Werner Lemberg 2018-07-25 07:03:07 +02:00
parent 4b97ab98a8
commit 580c94d8f7
2 changed files with 11 additions and 3 deletions

View File

@ -1,3 +1,11 @@
2018-07-25 Werner Lemberg <wl@gnu.org>
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 <apodtele@gmail.com>
[build] Fortify dllexport/dllimport attributes (#53969,#54330).

View File

@ -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;