From 4aeb78e788b78a4bec6fa02f3ea04a84c035ccbc Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sun, 20 Mar 2022 00:31:58 +0100 Subject: [PATCH] LoadVoice: Fix phonemes_name initialization phonemes_name is only initialized when V_LANGUAGE is met. This is not necessarily the case, notably with testing espeak_SetVoiceByName("!v/Annie") (language variant; intonation) Cannot set intonation: language not set, or is invalid. Uninitialized bytes in __interceptor_strcmp at offset 0 inside [0x7fff8a875e30, 1) ==4169902==WARNING: MemorySanitizer: use-of-uninitialized-value #0 0x4c6a49 in LookupPhonemeTable /home/samy/brl/speech/espeak-ng-git/src/libespeak-ng/synthdata.c:363:7 #1 0x4c6a49 in SelectPhonemeTableName /home/samy/brl/speech/espeak-ng-git/src/libespeak-ng/synthdata.c:380:12 #2 0x5098a9 in LoadVoice /home/samy/brl/speech/espeak-ng-git/src/libespeak-ng/voices.c:950:34 #3 0x50edcf in espeak_ng_SetVoiceByName /home/samy/brl/speech/espeak-ng-git/src/libespeak-ng/voices.c:1585:7 #4 0x4aad63 in espeak_SetVoiceByName /home/samy/brl/speech/espeak-ng-git/src/libespeak-ng/espeak_api.c:125:32 #5 0x4a3fe1 in test_espeak_set_voice_by_name_language_variant_intonation_parameter /home/samy/brl/speech/espeak-ng-git/tests/api.c:356:2 #6 0x4a3fe1 in main /home/samy/brl/speech/espeak-ng-git/tests/api.c:567:2 #7 0x7f26e88cb7fc in __libc_start_main csu/../csu/libc-start.c:332:16 #8 0x4213a9 in _start (/home/samy/ens/projet/1/speech/espeak-ng-git/tests/api.test+0x4213a9) Uninitialized value was created by an allocation of 'phonemes_name' in the stack frame of function 'LoadVoice' #0 0x504290 in LoadVoice /home/samy/brl/speech/espeak-ng-git/src/libespeak-ng/voices.c:519 so better catch it properly rather than relying on uninitialized data. --- src/libespeak-ng/voices.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libespeak-ng/voices.c b/src/libespeak-ng/voices.c index 83af5c90..add6b94e 100644 --- a/src/libespeak-ng/voices.c +++ b/src/libespeak-ng/voices.c @@ -540,7 +540,7 @@ voice_t *LoadVoice(const char *vname, int control) char language_name[40]; char translator_name[40]; char new_dictionary[40]; - char phonemes_name[40]; + char phonemes_name[40] = ""; const char *language_type; char buf[sizeof(path_home)+30]; char path_voices[sizeof(path_home)+12];