[PATCH wayland 2/6] scanner: Fail if 'since' is higher than the interface version
Marek Chalupa
mchqwerty at gmail.com
Mon Jan 11 01:50:53 PST 2016
Hi,
patches 1-2
Reviewed-by: Marek Chalupa <mchqwerty at gmail.com>
Cheers,
Marek
On 12/29/2015 03:10 AM, Jonas Ådahl wrote:
> If an event or request have a "since" attribute that is larger than
> the version of the interface it is in, fail with an explaining error
> message.
>
> Signed-off-by: Jonas Ådahl <jadahl at gmail.com>
> ---
> src/scanner.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/src/scanner.c b/src/scanner.c
> index 3f79a44..b00f036 100644
> --- a/src/scanner.c
> +++ b/src/scanner.c
> @@ -674,8 +674,12 @@ start_element(void *data, const char *element_name, const char **atts)
>
> if (since != NULL) {
> version = strtouint(since);
> - if (version == -1)
> + if (version == -1) {
> fail(&ctx->loc, "invalid integer (%s)\n", since);
> + } else if (version > ctx->interface->version) {
> + fail(&ctx->loc, "since (%u) larger than version (%u)\n",
> + version, ctx->interface->version);
> + }
> } else {
> version = 1;
> }
>
More information about the wayland-devel
mailing list