diff options
Diffstat (limited to 'test/xi2/protocol-xiselectevents.c')
-rw-r--r-- | test/xi2/protocol-xiselectevents.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/test/xi2/protocol-xiselectevents.c b/test/xi2/protocol-xiselectevents.c index 825eeb628..ac38c53c9 100644 --- a/test/xi2/protocol-xiselectevents.c +++ b/test/xi2/protocol-xiselectevents.c @@ -95,7 +95,14 @@ static void request_XISelectEvent(xXISelectEventsReq *req, int error) ClientRec client; xXIEventMask *mask, *next; - req->length = (sz_xXISelectEventsReq/4) + req->num_masks; + req->length = (sz_xXISelectEventsReq/4); + mask = (xXIEventMask*)&req[1]; + for (i = 0; i < req->num_masks; i++) + { + req->length += sizeof(xXIEventMask)/4 + mask->mask_len; + mask = (xXIEventMask*)((char*)&mask[1] + mask->mask_len * 4); + } + client = init_client(req->length, req); rc = ProcXISelectEvents(&client); @@ -280,16 +287,24 @@ static void test_XISelectEvents(void) req->num_masks = 0xFFFF; request_XISelectEvent(req, BadLength); - /* testing various device ids */ req->win = ROOT_WINDOW_ID; req->num_masks = 1; + g_test_message("Triggering bogus mask length error"); + mask = (xXIEventMask*)&req[1]; + mask->deviceid = 0; + mask->mask_len = 0xFFFF; + request_XISelectEvent(req, BadLength); + + /* testing various device ids */ g_test_message("Testing existing device ids."); for (i = 0; i < 6; i++) { mask = (xXIEventMask*)&req[1]; mask->deviceid = i; mask->mask_len = 1; + req->win = ROOT_WINDOW_ID; + req->num_masks = 1; request_XISelectEvent(req, Success); } |