File 0005-scanner-Also-fail-when-an-implicitly-versioned-messa.patch of Package wayland.3007

From 99a72777f96f63e4e25dc528bb37115424adac59 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
Date: Thu, 8 May 2014 23:39:47 +0200
Subject: [PATCH 2/8] scanner: Also fail when an implicitly versioned message
 is out of order
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Fail if a message with version implicitly set to 1 (i.e. not specified)
comes after a message with since-version > 1.

Signed-off-by: Jonas Ã…dahl <jadahl@gmail.com>
---
 src/scanner.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/scanner.c b/src/scanner.c
index dd1c7b6..28fadb0 100644
--- a/src/scanner.c
+++ b/src/scanner.c
@@ -404,12 +404,14 @@ start_element(void *data, const char *element_name, const char **atts)
 			if (errno == EINVAL || end == since || *end != '\0')
 				fail(&ctx->loc,
 				     "invalid integer (%s)\n", since);
-			if (version < ctx->interface->since)
-				fail(&ctx->loc, "since version not increasing\n");
-			ctx->interface->since = version;
+		} else {
+			version = 1;
 		}
 
-		message->since = ctx->interface->since;
+		if (version < ctx->interface->since)
+			fail(&ctx->loc, "since version not increasing\n");
+		ctx->interface->since = version;
+		message->since = version;
 
 		if (strcmp(name, "destroy") == 0 && !message->destructor)
 			fail(&ctx->loc, "destroy request should be destructor type");
-- 
2.8.1

openSUSE Build Service is sponsored by