mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-10-31 05:35:35 +00:00
Compare variant_name with "!v" only if long enough
Various places call SetVoiceStack with "" for the variant_name. This causes -fsanitize=address to fail with an overflow as the call to memcmp is checking the first 2 bytes, and there is only 1 byte available.
This commit is contained in:
@@ -599,7 +599,7 @@ void SetVoiceStack(espeak_VOICE *v, const char *variant_name)
|
||||
sp->voice_age = v->age;
|
||||
sp->voice_gender = v->gender;
|
||||
|
||||
if (memcmp(variant_name, "!v", 2) == 0)
|
||||
if (strlen(variant_name) >= 2 && memcmp(variant_name, "!v", 2) == 0)
|
||||
variant_name += 3; // strip variant directory name, !v plus PATHSEP
|
||||
strncpy0(base_voice_variant_name, variant_name, sizeof(base_voice_variant_name));
|
||||
memcpy(&base_voice, ¤t_voice_selected, sizeof(base_voice));
|
||||
|
||||
Reference in New Issue
Block a user