summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Cristau <jcristau@debian.org>2008-11-26 21:19:55 +0100
committerJulien Cristau <jcristau@debian.org>2008-12-03 17:33:47 +0100
commit0b5ecabfb803cd820338fb0364521fe39b05578b (patch)
treecc0099bc0a8fb59635c921dbe85520b7d8b77d65
parent110a71d11ab7a1a55a6a24d792457fdef0b0746d (diff)
randr: add swapped dispatch for RR[GS]etCrtcTransform
Fix a memory leak in ProcRRGetCrtcTransform() while I'm at it. Signed-off-by: Julien Cristau <jcristau@debian.org> Cc: Keith Packard <keithp@keithp.com>
-rw-r--r--randr/rrcrtc.c6
-rw-r--r--randr/rrsdispatch.c29
2 files changed, 25 insertions, 10 deletions
diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c
index 5d270ce12..90d93b513 100644
--- a/randr/rrcrtc.c
+++ b/randr/rrcrtc.c
@@ -1150,8 +1150,7 @@ transform_filter_encode (ClientPtr client, char *output,
1150 if (client->swapped) { 1150 if (client->swapped) {
1151 swaps (nbytesFilter, n); 1151 swaps (nbytesFilter, n);
1152 swaps (nparamsFilter, n); 1152 swaps (nparamsFilter, n);
1153 SwapLongs ((CARD32 *) (output + nbytes), 1153 SwapLongs ((CARD32 *) (output + nbytes), nparams);
1154 nparams * sizeof (xFixed));
1155 } 1154 }
1156 nbytes += nparams * sizeof (xFixed); 1155 nbytes += nparams * sizeof (xFixed);
1157 return nbytes; 1156 return nbytes;
@@ -1162,7 +1161,7 @@ transform_encode (ClientPtr client, xRenderTransform *wire, PictTransform *pict)
1162{ 1161{
1163 xRenderTransform_from_PictTransform (wire, pict); 1162 xRenderTransform_from_PictTransform (wire, pict);
1164 if (client->swapped) 1163 if (client->swapped)
1165 SwapLongs ((CARD32 *) wire, sizeof (xRenderTransform)); 1164 SwapLongs ((CARD32 *) wire, sizeof (xRenderTransform) >> 2);
1166} 1165}
1167 1166
1168int 1167int
@@ -1214,5 +1213,6 @@ ProcRRGetCrtcTransform (ClientPtr client)
1214 swapl (&reply->length, n); 1213 swapl (&reply->length, n);
1215 } 1214 }
1216 WriteToClient (client, sizeof (xRRGetCrtcTransformReply) + nextra, (char *) reply); 1215 WriteToClient (client, sizeof (xRRGetCrtcTransformReply) + nextra, (char *) reply);
1216 xfree(reply);
1217 return client->noClientException; 1217 return client->noClientException;
1218} 1218}
diff --git a/randr/rrsdispatch.c b/randr/rrsdispatch.c
index 5a6dab5bf..d356ab049 100644
--- a/randr/rrsdispatch.c
+++ b/randr/rrsdispatch.c
@@ -367,21 +367,36 @@ SProcRRSetCrtcGamma (ClientPtr client)
367static int 367static int
368SProcRRSetCrtcTransform (ClientPtr client) 368SProcRRSetCrtcTransform (ClientPtr client)
369{ 369{
370 int n, nparams;
371 char *filter;
372 CARD32 *params;
370 REQUEST(xRRSetCrtcTransformReq); 373 REQUEST(xRRSetCrtcTransformReq);
371 374
372 REQUEST_SIZE_MATCH(xRRSetCrtcTransformReq); 375 REQUEST_AT_LEAST_SIZE(xRRSetCrtcTransformReq);
373 (void) stuff; 376 swaps(&stuff->length, n);
374 return BadImplementation; 377 swapl(&stuff->crtc, n);
378 SwapLongs((CARD32 *)&stuff->transform, (sizeof(xRenderTransform)) >> 2);
379 swaps(&stuff->nbytesFilter, n);
380 filter = (char *)(stuff + 1);
381 params = (CARD32 *) (filter + ((stuff->nbytesFilter + 3) & ~3));
382 nparams = ((CARD32 *) stuff + client->req_len) - params;
383 if (nparams < 0)
384 return BadLength;
385
386 SwapLongs(params, nparams);
387 return (*ProcRandrVector[stuff->randrReqType]) (client);
375} 388}
376 389
377static int 390static int
378SProcRRGetCrtcTransform (ClientPtr client) 391SProcRRGetCrtcTransform (ClientPtr client)
379{ 392{
393 int n;
380 REQUEST(xRRGetCrtcTransformReq); 394 REQUEST(xRRGetCrtcTransformReq);
381 395
382 REQUEST_SIZE_MATCH(xRRGetCrtcTransformReq); 396 REQUEST_SIZE_MATCH(xRRGetCrtcTransformReq);
383 (void) stuff; 397 swaps(&stuff->length, n);
384 return BadImplementation; 398 swapl(&stuff->crtc, n);
399 return (*ProcRandrVector[stuff->randrReqType]) (client);
385} 400}
386 401
387int (*SProcRandrVector[RRNumberRequests])(ClientPtr) = { 402int (*SProcRandrVector[RRNumberRequests])(ClientPtr) = {