summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2014-02-09 22:42:47 -0800
committerJulien Cristau <jcristau@debian.org>2014-12-09 17:50:13 +0100
commit5a4760babdfeb114d1e89df735496f042df352fe (patch)
tree11d512fe68ddcc38c0c16fe643713ef54f00344e
parentefacb60e01513e9a96f2630159727835e2a8af0b (diff)
Add REQUEST_FIXED_SIZE testcases to test/misc.c
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> (cherry picked from commit f4afd53f2aeaddf509bf9f71d1716dd273fd6e14) Signed-off-by: Julien Cristau <jcristau@debian.org>
-rw-r--r--test/misc.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/test/misc.c b/test/misc.c
index dd792e692..66330a140 100644
--- a/test/misc.c
+++ b/test/misc.c
@@ -28,6 +28,8 @@
#include <stdint.h>
#include "misc.h"
#include "scrnintstr.h"
+#include "dix.h"
+#include "dixstruct.h"
ScreenInfo screenInfo;
@@ -155,11 +157,46 @@ dix_update_desktop_dimensions(void)
assert_dimensions(-w2, -h2, w2, h2);
}
+static int
+dix_request_fixed_size_overflow(ClientRec *client)
+{
+ xReq req = { 0 };
+
+ client->req_len = req.length = 1;
+ REQUEST_FIXED_SIZE(req, SIZE_MAX);
+ return Success;
+}
+
+static int
+dix_request_fixed_size_match(ClientRec *client)
+{
+ xReq req = { 0 };
+
+ client->req_len = req.length = 9;
+ REQUEST_FIXED_SIZE(req, 30);
+ return Success;
+}
+
+static void
+dix_request_size_checks(void)
+{
+ ClientRec client = { 0 };
+ int rc;
+
+ rc = dix_request_fixed_size_overflow(&client);
+ assert(rc == BadLength);
+
+ rc = dix_request_fixed_size_match(&client);
+ assert(rc == Success);
+}
+
+
int
main(int argc, char **argv)
{
dix_version_compare();
dix_update_desktop_dimensions();
+ dix_request_size_checks();
return 0;
}