So valgrind can potentially catch e.g. missing \0.master
@@ -223,6 +223,8 @@ char *DecodeRule(const char *group_chars, int group_length, char *rule, int cont | |||
char suffix[20]; | |||
static char output[80]; | |||
MAKE_MEM_UNDEFINED(&output, sizeof(output)); | |||
static const char symbols[] = { | |||
' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', | |||
'&', '%', '+', '#', 'S', 'D', 'Z', 'A', 'L', '!', |
@@ -2875,6 +2875,8 @@ int LookupDictList(Translator *tr, char **wordptr, char *ph_out, unsigned int *f | |||
char word[N_WORD_BYTES]; | |||
static char word_replacement[N_WORD_BYTES]; | |||
MAKE_MEM_UNDEFINED(&word_replacement, sizeof(word_replacement)); | |||
length = 0; | |||
word2 = word1 = *wordptr; | |||
@@ -187,6 +187,8 @@ const char *WordToString2(unsigned int word) | |||
static char buf[5]; | |||
char *p; | |||
MAKE_MEM_UNDEFINED(&buf, sizeof(buf)); | |||
p = buf; | |||
for (ix = 3; ix >= 0; ix--) { | |||
if ((*p = word >> (ix*8)) != 0) | |||
@@ -227,6 +229,8 @@ static const char *LookupCharName(Translator *tr, int c, int only) | |||
char *string; | |||
static char buf[60]; | |||
MAKE_MEM_UNDEFINED(&buf, sizeof(buf)); | |||
buf[0] = 0; | |||
flags[0] = 0; | |||
flags[1] = 0; | |||
@@ -541,8 +545,10 @@ int ReadClause(Translator *tr, char *buf, short *charix, int *charix_top, int n_ | |||
c1 = c2; | |||
if (ungot_string_ix >= 0) { | |||
if (ungot_string[ungot_string_ix] == 0) | |||
if (ungot_string[ungot_string_ix] == 0) { | |||
MAKE_MEM_UNDEFINED(&ungot_string, sizeof(ungot_string)); | |||
ungot_string_ix = -1; | |||
} | |||
} | |||
if ((ungot_string_ix == 0) && (ungot_char2 == 0)) |
@@ -47,6 +47,7 @@ | |||
#include "synthesize.h" // for SPEED_FACTORS, speed | |||
#include "translate.h" // for CTRL_EMBEDDED, IsDigit09, utf8_out | |||
#include "voice.h" // for SelectVoice, SelectVoiceByName | |||
#include "speech.h" // for MAKE_MEM_UNDEFINED | |||
static const MNEM_TAB ssmltags[] = { | |||
{ "speak", SSML_SPEAK }, | |||
@@ -214,6 +215,8 @@ static const char *VoiceFromStack(SSML_STACK *ssml_stack, int n_ssml_stack, espe | |||
char language[40]; | |||
char buf[80]; | |||
MAKE_MEM_UNDEFINED(&voice_name, sizeof(voice_name)); | |||
strcpy(voice_name, ssml_stack[0].voice_name); | |||
strcpy(language, ssml_stack[0].language); | |||
voice_select.age = ssml_stack[0].voice_age; |
@@ -253,6 +253,8 @@ static char *WritePitch(int env, int pitch1, int pitch2, int split, int final) | |||
char buf[50]; | |||
static char output[50]; | |||
MAKE_MEM_UNDEFINED(&output, sizeof(output)); | |||
output[0] = 0; | |||
pitch_env = envelope_data[env]; | |||
@@ -208,6 +208,8 @@ frameref_t *LookupSpect(PHONEME_TAB *this_ph, int which, FMT_PARAMS *fmt_params, | |||
frame_t *frame; | |||
static frameref_t frames_buf[N_SEQ_FRAMES]; | |||
MAKE_MEM_UNDEFINED(&frames_buf, sizeof(frames_buf)); | |||
seq = (SPECT_SEQ *)(&phondata_ptr[fmt_params->fmt_addr]); | |||
seqk = (SPECT_SEQK *)seq; | |||
nf = seq->n_frames; |
@@ -43,6 +43,7 @@ | |||
#include "translate.h" // for translator, LANGUAGE_OPTIONS, Trans... | |||
#include "voice.h" // for voice_t, voice, LoadVoiceVariant | |||
#include "wavegen.h" // for WcmdqInc, WcmdqFree, WcmdqStop | |||
#include "speech.h" // for MAKE_MEM_UNDEFINED | |||
static void SmoothSpect(void); | |||
@@ -77,6 +78,8 @@ const char *WordToString(unsigned int word) | |||
int ix; | |||
static char buf[5]; | |||
MAKE_MEM_UNDEFINED(&buf, sizeof(buf)); | |||
for (ix = 0; ix < 4; ix++) | |||
buf[ix] = word >> (ix*8); | |||
buf[4] = 0; | |||
@@ -388,6 +391,8 @@ static frame_t *AllocFrame() | |||
ix++; | |||
if (ix >= N_FRAME_POOL) | |||
ix = 0; | |||
MAKE_MEM_UNDEFINED(&frame_pool[ix], sizeof(frame_pool[ix])); | |||
return &frame_pool[ix]; | |||
} | |||
@@ -1988,6 +1988,8 @@ void TranslateClause(Translator *tr, int *tone_out, char **voice_change) | |||
if (tr == NULL) | |||
return; | |||
MAKE_MEM_UNDEFINED(&voice_change_name, sizeof(voice_change_name)); | |||
embedded_ix = 0; | |||
embedded_read = 0; | |||
pre_pause = 0; |
@@ -982,6 +982,7 @@ static char *ExtractVoiceVariantName(char *vname, int variant_num, int add_dir) | |||
static char variant_name[40]; | |||
char variant_prefix[5]; | |||
MAKE_MEM_UNDEFINED(&variant_name, sizeof(variant_name)); | |||
variant_name[0] = 0; | |||
sprintf(variant_prefix, "!v%c", PATHSEP); | |||
if (add_dir == 0) | |||
@@ -1319,6 +1320,9 @@ char const *SelectVoice(espeak_VOICE *voice_select, int *found) | |||
static espeak_VOICE voice_variants[N_VOICE_VARIANTS]; | |||
static char voice_id[50]; | |||
MAKE_MEM_UNDEFINED(&voice_variants, sizeof(voice_variants)); | |||
MAKE_MEM_UNDEFINED(&voice_id, sizeof(voice_id)); | |||
*found = 1; | |||
memcpy(&voice_select2, voice_select, sizeof(voice_select2)); | |||
@@ -1329,6 +1333,8 @@ char const *SelectVoice(espeak_VOICE *voice_select, int *found) | |||
// no language is specified. Get language from the named voice | |||
static char buf[60]; | |||
MAKE_MEM_UNDEFINED(&buf, sizeof(buf)); | |||
if (voice_select2.name == NULL) { | |||
if ((voice_select2.name = voice_select2.identifier) == NULL) | |||
voice_select2.name = ESPEAKNG_DEFAULT_VOICE; |