Browse Source

Check the return value of sscanf in LoadVoice(voices.c) [clang scan-build]

master
Reece H. Dunn 9 years ago
parent
commit
cb3699746c
1 changed files with 6 additions and 8 deletions
  1. 6
    8
      src/libespeak-ng/voices.c

+ 6
- 8
src/libespeak-ng/voices.c View File

@@ -719,15 +719,13 @@ voice_t *LoadVoice(const char *vname, int control)
VoiceFormant(p);
break;
case V_PITCH:
{
double factor;
// default is pitch 82 118
n = sscanf(p, "%d %d", &pitch1, &pitch2);
voice->pitch_base = (pitch1 - 9) << 12;
voice->pitch_range = (pitch2 - pitch1) * 108;
factor = (double)(pitch1 - 82)/82;
voice->formant_factor = (int)((1+factor/4) * 256); // nominal formant shift for a different voice pitch
}
if (sscanf(p, "%d %d", &pitch1, &pitch2) == 2) {
voice->pitch_base = (pitch1 - 9) << 12;
voice->pitch_range = (pitch2 - pitch1) * 108;
double factor = (double)(pitch1 - 82)/82;
voice->formant_factor = (int)((1+factor/4) * 256); // nominal formant shift for a different voice pitch
}
break;
case V_STRESSLENGTH: // stressLength
stress_lengths_set = Read8Numbers(p, stress_lengths);

Loading…
Cancel
Save