mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-12 07:26:15 +01:00
Don't skip invalid enum values in schemas
Signed-off-by: Maks Naumov <maksqwe1@ukr.net> https://bugzilla.gnome.org/show_bug.cgi?id=742997
This commit is contained in:
parent
30b25a6fd9
commit
12e32e96a3
@ -97,9 +97,9 @@ enum_state_add_value (EnumState *state,
|
||||
}
|
||||
|
||||
value = g_ascii_strtoll (valuestr, &end, 0);
|
||||
if (*end || state->is_flags ?
|
||||
if (*end || (state->is_flags ?
|
||||
(value > G_MAXUINT32 || value < 0) :
|
||||
(value > G_MAXINT32 || value < G_MININT32))
|
||||
(value > G_MAXINT32 || value < G_MININT32)))
|
||||
{
|
||||
g_set_error (error, G_MARKUP_ERROR,
|
||||
G_MARKUP_ERROR_INVALID_CONTENT,
|
||||
|
@ -86,6 +86,7 @@ static const SchemaTest tests[] = {
|
||||
{ "enum", NULL, NULL },
|
||||
{ "enum-with-aliases", NULL, NULL },
|
||||
{ "enum-with-invalid-alias", NULL, "*“banger” is not in enumerated type*" },
|
||||
{ "enum-with-invalid-value", NULL, "*invalid numeric value*" },
|
||||
{ "enum-with-repeated-alias", NULL, "*<alias value='sausages'/> already specified*" },
|
||||
{ "enum-with-repeated-nick", NULL, "*<value nick='spam'/> already specified*" },
|
||||
{ "enum-with-repeated-value", NULL, "*value='1' already specified*" },
|
||||
|
10
gio/tests/schema-tests/enum-with-invalid-value.gschema.xml
Normal file
10
gio/tests/schema-tests/enum-with-invalid-value.gschema.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<schemalist>
|
||||
<enum id='org.gtk.test.MyEnum'>
|
||||
<value nick='nospam' value='*'/>
|
||||
<value nick='spam' value='1'/>
|
||||
<value nick='ham' value='2'/>
|
||||
<value nick='eggs' value='3'/>
|
||||
<value nick='bangers' value='4'/>
|
||||
<value nick='mash' value='5'/>
|
||||
</enum>
|
||||
</schemalist>
|
Loading…
Reference in New Issue
Block a user