When running any of the following: espeak -x "[[]]" espeak --ipa "[[]]" eSpeak would SEGFAULT. This is because phon_out_buf is NULL as no phonemes have been written and as this is the first call to GetTranslatedPhonemeString, the phoneme buffer has not been allocated yet. However, GetTranslatedPhonemeString attempts to add a NULL character to the end of the phoneme buffer, and thus crashes.master
@@ -1,6 +1,7 @@ | |||
/*************************************************************************** | |||
* Copyright (C) 2005 to 2013 by Jonathan Duddington * | |||
* email: [email protected] * | |||
* Copyright (C) 2013 Reece H. Dunn * | |||
* * | |||
* This program is free software; you can redistribute it and/or modify * | |||
* it under the terms of the GNU General Public License as published by * | |||
@@ -769,6 +770,10 @@ const char *GetTranslatedPhonemeString(int phoneme_mode) | |||
strcpy(&phon_out_buf[phon_out_ix], phon_buf); | |||
phon_out_ix += len; | |||
} | |||
if (!phon_out_buf) | |||
return(""); | |||
phon_out_buf[phon_out_ix] = 0; | |||
return(phon_out_buf); |