(svn r21134) -Change: perform some more stringent validity checking on the language files

This commit is contained in:
rubidium
2010-11-10 17:49:44 +00:00
parent 17b514ccd1
commit 1ddc05e822
2 changed files with 12 additions and 2 deletions

View File

@@ -1307,7 +1307,16 @@ bool LanguagePackHeader::IsValid() const
{
return
this->ident == TO_LE32(LanguagePackHeader::IDENT) &&
this->version == TO_LE32(LANGUAGE_PACK_VERSION);
this->version == TO_LE32(LANGUAGE_PACK_VERSION) &&
this->plural_form < LANGUAGE_MAX_PLURAL &&
this->text_dir <= 1 &&
this->newgrflangid < MAX_LANG &&
StrValid(this->name, lastof(this->name)) &&
StrValid(this->own_name, lastof(this->own_name)) &&
StrValid(this->isocode, lastof(this->isocode)) &&
StrValid(this->digit_group_separator, lastof(this->digit_group_separator)) &&
StrValid(this->digit_group_separator_currency, lastof(this->digit_group_separator_currency)) &&
StrValid(this->digit_decimal_separator, lastof(this->digit_decimal_separator));
}
bool ReadLanguagePack(int lang_index)