From 199cbe4a1a84b6092c19937088061ef68e4ba509 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Mon, 4 Apr 2022 21:24:17 +0200 Subject: [PATCH] Mark re-used phoneme_list as undefined And fill the last phlist prepause and newword fields, otherwise they are detected as undefined: ==483407== Conditional jump or move depends on uninitialised value(s) ==483407== at 0x488E6AB: Generate (synthesize.c:1228) ==483407== by 0x488FD94: SpeakNextClause (synthesize.c:1587) ==483407== by 0x4887F56: Synthesize (speech.c:457) ==483407== by 0x488884C: sync_espeak_Synth (speech.c:570) ==483407== by 0x487B270: espeak_Synth (espeak_api.c:90) ==483407== by 0x10ACA0: main (espeak-ng.c:691) ==483407== Uninitialised value was created by a client request ==483407== at 0x4884893: MakePhonemeList (phonemelist.c:155) ==483407== by 0x4895712: TranslateClause (translate.c:2682) ==483407== by 0x488FCCF: SpeakNextClause (synthesize.c:1569) ==483407== by 0x4887F56: Synthesize (speech.c:457) ==483407== by 0x488884C: sync_espeak_Synth (speech.c:570) ==483407== by 0x487B270: espeak_Synth (espeak_api.c:90) ==483407== by 0x10ACA0: main (espeak-ng.c:691) ==483407== ==483407== Conditional jump or move depends on uninitialised value(s) ==483407== at 0x488E622: Generate (synthesize.c:1211) ==483407== by 0x488FD94: SpeakNextClause (synthesize.c:1587) ==483407== by 0x4887F56: Synthesize (speech.c:457) ==483407== by 0x488884C: sync_espeak_Synth (speech.c:570) ==483407== by 0x487B270: espeak_Synth (espeak_api.c:90) ==483407== by 0x10ACA0: main (espeak-ng.c:691) ==483407== Uninitialised value was created by a client request ==483407== at 0x4884893: MakePhonemeList (phonemelist.c:155) ==483407== by 0x4895712: TranslateClause (translate.c:2682) ==483407== by 0x488FCCF: SpeakNextClause (synthesize.c:1569) ==483407== by 0x4887F56: Synthesize (speech.c:457) ==483407== by 0x488884C: sync_espeak_Synth (speech.c:570) ==483407== by 0x487B270: espeak_Synth (espeak_api.c:90) ==483407== by 0x10ACA0: main (espeak-ng.c:691) ==483407== This is changing the ssml.test output, but with no audible difference, so this is probably a real fix for it. --- src/libespeak-ng/phonemelist.c | 6 ++++++ tests/ssml.test | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/libespeak-ng/phonemelist.c b/src/libespeak-ng/phonemelist.c index 7446ea30..4bd5c52f 100644 --- a/src/libespeak-ng/phonemelist.c +++ b/src/libespeak-ng/phonemelist.c @@ -38,6 +38,7 @@ #include "phoneme.h" #include "synthesize.h" #include "translate.h" +#include "speech.h" const unsigned char pause_phonemes[8] = { 0, phonPAUSE_VSHORT, phonPAUSE_SHORT, phonPAUSE, phonPAUSE_LONG, phonGLOTTALSTOP, phonPAUSE_LONG, phonPAUSE_LONG @@ -147,6 +148,7 @@ void MakePhonemeList(Translator *tr, int post_pause, bool start_sentence) plist2 = ph_list2; phlist = phoneme_list; end_sourceix = plist2[n_ph_list2-1].sourceix; + MAKE_MEM_UNDEFINED(&phoneme_list, sizeof(phoneme_list)); // is the last word of the clause unstressed ? max_stress = 0; @@ -557,13 +559,17 @@ void MakePhonemeList(Translator *tr, int post_pause, bool start_sentence) phlist[ix].length = post_pause; // length of the pause, depends on the punctuation phlist[ix].sourceix = end_sourceix; phlist[ix].synthflags = 0; + phlist[ix].prepause = 0; phlist[ix++].ph = phoneme_tab[phonPAUSE]; + phlist[ix].newword = 0; + phlist[ix].phcode = phonPAUSE; phlist[ix].type = phPAUSE; phlist[ix].length = 0; phlist[ix].sourceix = 0; phlist[ix].synthflags = 0; + phlist[ix].prepause = 0; phlist[ix++].ph = phoneme_tab[phonPAUSE_SHORT]; n_phoneme_list = ix; diff --git a/tests/ssml.test b/tests/ssml.test index 7bb2435d..60adf5cb 100755 --- a/tests/ssml.test +++ b/tests/ssml.test @@ -39,8 +39,8 @@ test_ssml() { for i in `ls tests/ssml/*.ssml` ; do test_ssml $i; done for i in `ls tests/ssml/*.ssml2` ; do test_ssml $i punct; done -test_ssml_audio "" fcb28f00670959980038171ceda3c6bdec61b884 " Slow and low Fast and high." +test_ssml_audio "" 88fccb35536158f25f4ae44a03fb005fef95c99b " Slow and low Fast and high." # #410 is a bug in SSML. Sentence termination causes prosody stack to misfunction. -# Hash 00879af is the buggy version and should fail: -test_ssml_audio " bug #410" 00879aff11dc28a352736ca397ce9567e6f39029 " Slow and low. Fast and high." +# Hash 8d3bace is the buggy version and should fail: +test_ssml_audio " bug #410" 8d3bace9548ae73c4770a73c88c6f65e848b45cf " Slow and low. Fast and high." test_ssml_audio "