Validate encoding in .ifo files

This commit is contained in:
Přemysl Eric Janouch 2016-09-28 03:03:42 +02:00
parent 474bcb518a
commit ff0ec60931
Signed by: p
GPG Key ID: B715679E3A361BE6
1 changed files with 7 additions and 0 deletions

View File

@ -253,6 +253,13 @@ load_ifo (StardictInfo *sti, const gchar *path, GError **error)
continue;
}
if (!g_utf8_validate (ir.value, -1, NULL))
{
g_set_error (error, STARDICT_ERROR, STARDICT_ERROR_INVALID_DATA,
"%s: %s", path, _("invalid encoding, must be valid UTF-8"));
goto error;
}
if (_stardict_ifo_keys[i].type == IFO_STRING)
{
G_STRUCT_MEMBER (gchar *, sti, _stardict_ifo_keys[i].offset)