From 0b5ecabfb803cd820338fb0364521fe39b05578b Mon Sep 17 00:00:00 2001 From: Julien Cristau Date: Wed, 26 Nov 2008 21:19:55 +0100 Subject: randr: add swapped dispatch for RR[GS]etCrtcTransform Fix a memory leak in ProcRRGetCrtcTransform() while I'm at it. Signed-off-by: Julien Cristau Cc: Keith Packard --- randr/rrsdispatch.c | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) (limited to 'randr/rrsdispatch.c') 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) static int SProcRRSetCrtcTransform (ClientPtr client) { + int n, nparams; + char *filter; + CARD32 *params; REQUEST(xRRSetCrtcTransformReq); - - REQUEST_SIZE_MATCH(xRRSetCrtcTransformReq); - (void) stuff; - return BadImplementation; + + REQUEST_AT_LEAST_SIZE(xRRSetCrtcTransformReq); + swaps(&stuff->length, n); + swapl(&stuff->crtc, n); + SwapLongs((CARD32 *)&stuff->transform, (sizeof(xRenderTransform)) >> 2); + swaps(&stuff->nbytesFilter, n); + filter = (char *)(stuff + 1); + params = (CARD32 *) (filter + ((stuff->nbytesFilter + 3) & ~3)); + nparams = ((CARD32 *) stuff + client->req_len) - params; + if (nparams < 0) + return BadLength; + + SwapLongs(params, nparams); + return (*ProcRandrVector[stuff->randrReqType]) (client); } static int SProcRRGetCrtcTransform (ClientPtr client) { + int n; REQUEST(xRRGetCrtcTransformReq); - + REQUEST_SIZE_MATCH(xRRGetCrtcTransformReq); - (void) stuff; - return BadImplementation; + swaps(&stuff->length, n); + swapl(&stuff->crtc, n); + return (*ProcRandrVector[stuff->randrReqType]) (client); } int (*SProcRandrVector[RRNumberRequests])(ClientPtr) = { -- cgit v1.2.3