mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-11-25 12:46:13 +00:00
Mark re-used buffers as undefined
These are global arrays reused several times. When using them msan and valgrind thus believe they are always initialized, which reduces their capacity to detect uninitialized values. We can however explicitly tell them when they are reused, and thus to be considered as uninitialized.
This commit is contained in:
@@ -23,6 +23,21 @@
|
||||
#include <endian.h> // for BYTE_ORDER, BIG_ENDIAN
|
||||
#include <espeak-ng/espeak_ng.h>
|
||||
|
||||
#if defined(__has_feature)
|
||||
# if __has_feature(memory_sanitizer)
|
||||
# include <sanitizer/msan_interface.h>
|
||||
# define MAKE_MEM_UNDEFINED(addr, len) __msan_unpoison(addr, len)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef MAKE_MEM_UNDEFINED
|
||||
# ifdef HAVE_VALGRIND_MEMCHECK_H
|
||||
# include <valgrind/memcheck.h>
|
||||
# define MAKE_MEM_UNDEFINED(addr, len) VALGRIND_MAKE_MEM_UNDEFINED(addr, len)
|
||||
# else
|
||||
# define MAKE_MEM_UNDEFINED(addr, len) ((void) (addr, len))
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
|
||||
Reference in New Issue
Block a user