mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-12-03 06:55:44 +00:00
CheckThousandsGroup: Avoid reading uninitialized data
For the case when word is smaller than 4 characters, we should not look at the 3rd or 4th character before checking the previous ones, otherwise we'd at best read uninitialized data, at worse non-existing data.
This commit is contained in:
@@ -1719,13 +1719,14 @@ static bool CheckThousandsGroup(char *word, int group_len)
|
||||
// Is this a group of 3 digits which looks like a thousands group?
|
||||
int ix;
|
||||
|
||||
if (IsDigit09(word[group_len]) || IsDigit09(-1))
|
||||
return false;
|
||||
|
||||
for (ix = 0; ix < group_len; ix++) {
|
||||
if (!IsDigit09(word[ix]))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (IsDigit09(word[group_len]) || IsDigit09(-1))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user