mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 02:27:39 -04:00
talk.h make voice files check for proper number of entries on load
In addition to version and target also check id1_max & id2_max for proper length before allowing voice file to be loaded Change-Id: I36016059d07781b0bb43dd9873bbb6e565298d76
This commit is contained in:
parent
4382d3f5ed
commit
c93666d08e
3 changed files with 10 additions and 2 deletions
|
@ -613,7 +613,9 @@ static bool load_voicefile_index(int fd)
|
|||
if (voicefile.table == sizeof(struct voicefile_header))
|
||||
{
|
||||
if (voicefile.version == VOICE_VERSION &&
|
||||
voicefile.target_id == TARGET_ID)
|
||||
voicefile.target_id == TARGET_ID &&
|
||||
voicefile.id1_max == TALK_FINAL_ID &&
|
||||
voicefile.id2_max == TALK_FINAL_ID_VOICEONLY - VOICEONLY_DELIMITER)
|
||||
{
|
||||
if (load_index_table(fd, &voicefile))
|
||||
return true;
|
||||
|
@ -621,6 +623,11 @@ static bool load_voicefile_index(int fd)
|
|||
}
|
||||
|
||||
logf("Incompatible voice file");
|
||||
logf("version %d expected %d", voicefile.version, VOICE_VERSION);
|
||||
logf("target_id %d expected %d", voicefile.target_id, TARGET_ID);
|
||||
logf("id1_max %d expected %d", voicefile.id1_max, TALK_FINAL_ID);
|
||||
logf("id2_max %d expected %d",
|
||||
voicefile.id2_max, TALK_FINAL_ID_VOICEONLY - VOICEONLY_DELIMITER);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -134,7 +134,7 @@ int talk_time_intervals(long time, int unit_idx, bool enqueue);
|
|||
|
||||
/* This (otherwise invalid) ID signals the end of the array. */
|
||||
#define TALK_FINAL_ID LANG_LAST_INDEX_IN_ARRAY
|
||||
|
||||
#define TALK_FINAL_ID_VOICEONLY LANG_LAST_VOICEONLY_INDEX_IN_ARRAY
|
||||
/* Enqueue next utterance even if enqueue parameter is false: don't
|
||||
interrupt the current utterance. */
|
||||
void talk_force_enqueue_next(void);
|
||||
|
|
|
@ -718,6 +718,7 @@ MOO
|
|||
|
||||
# Output end of lang_enum.h
|
||||
print HFILE_CORE <<MOO
|
||||
LANG_LAST_VOICEONLY_INDEX_IN_ARRAY /* this is not a string, this is a marker */
|
||||
};
|
||||
/* end of generated enum list */
|
||||
#endif /* _LANG_ENUM_H_ */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue