Browse Source

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.
master
Reece H. Dunn 7 years ago
parent
commit
c9ca77a4d4
1 changed files with 1 additions and 1 deletions
  1. 1
    1
      src/libespeak-ng/readclause.c

+ 1
- 1
src/libespeak-ng/readclause.c View File

@@ -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, &current_voice_selected, sizeof(base_voice));

Loading…
Cancel
Save