diff --git a/girepository/girnode-private.h b/girepository/girnode-private.h index 30fbab6cc..353d6d6ca 100644 --- a/girepository/girnode-private.h +++ b/girepository/girnode-private.h @@ -384,7 +384,7 @@ struct _GIIrNodeUnion size_t size; GIIrOffsetsState offsets_state; - int discriminator_offset; + size_t discriminator_offset; GIIrNodeType *discriminator_type; /* (owned) */ }; diff --git a/girepository/girparser.c b/girepository/girparser.c index 070f591bd..0d65590f6 100644 --- a/girepository/girparser.c +++ b/girepository/girparser.c @@ -2810,6 +2810,8 @@ start_discriminator (GMarkupParseContext *context, { const char *type; const char *offset; + guint64 parsed_offset; + if (!(strcmp (element_name, "discriminator") == 0 && ctx->state == STATE_UNION)) return FALSE; @@ -2829,8 +2831,11 @@ start_discriminator (GMarkupParseContext *context, ((GIIrNodeUnion *)CURRENT_NODE (ctx))->discriminator_type = parse_type (ctx, type); - ((GIIrNodeUnion *)CURRENT_NODE (ctx))->discriminator_offset - = atoi (offset); + + if (g_ascii_string_to_unsigned (offset, 10, 0, G_MAXSIZE, &parsed_offset, error)) + ((GIIrNodeUnion *)CURRENT_NODE (ctx))->discriminator_offset = parsed_offset; + else + return FALSE; return TRUE; }