mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-11-02 09:01:39 -05:00
scanner: Fail on more invalid XML files
These situations can happen if the XML is not valid according to the Wayland DTD. Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
This commit is contained in:
parent
cd5b4bcca7
commit
5802a083b4
1 changed files with 8 additions and 0 deletions
|
|
@ -784,6 +784,9 @@ start_element(void *data, const char *element_name, const char **atts)
|
|||
if (version == 0)
|
||||
fail(&ctx->loc, "no interface version given");
|
||||
|
||||
if (atts[4])
|
||||
fail(&ctx->loc, "unexpected attribute on interface");
|
||||
|
||||
validate_identifier(&ctx->loc, name, STANDALONE_IDENT);
|
||||
interface = create_interface(ctx->loc, name, version);
|
||||
ctx->interface = interface;
|
||||
|
|
@ -924,6 +927,9 @@ start_element(void *data, const char *element_name, const char **atts)
|
|||
} else if (strcmp(element_name, "description") == 0) {
|
||||
if (summary == NULL)
|
||||
fail(&ctx->loc, "description without summary");
|
||||
/* must be valid since summary attribute present */
|
||||
if (atts[2])
|
||||
fail(&ctx->loc, "description with non-summary attribute");
|
||||
|
||||
description = xzalloc(sizeof *description);
|
||||
description->summary = xstrdup(summary);
|
||||
|
|
@ -939,6 +945,8 @@ start_element(void *data, const char *element_name, const char **atts)
|
|||
else
|
||||
ctx->protocol->description = description;
|
||||
ctx->description = description;
|
||||
} else {
|
||||
fail(&ctx->loc, "unknown element %s", element_name);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue