From 462f18c7b25fe3e467f837647d07ab0a78aa8d2b Mon Sep 17 00:00:00 2001 From: marha Date: Sun, 22 Feb 2015 21:39:56 +0100 Subject: Merged origin/release (checked in because wanted to merge new stuff) --- xorg-server/dix/Xserver.d | 5 ++++- xorg-server/dix/dispatch.c | 8 ++++---- xorg-server/dix/events.c | 8 +------- xorg-server/dix/getevents.c | 13 ++++--------- xorg-server/dix/region.c | 20 +++++++++++++------- xorg-server/dix/resource.c | 5 +---- 6 files changed, 27 insertions(+), 32 deletions(-) (limited to 'xorg-server/dix') diff --git a/xorg-server/dix/Xserver.d b/xorg-server/dix/Xserver.d index 248d48e24..f4f229d84 100644 --- a/xorg-server/dix/Xserver.d +++ b/xorg-server/dix/Xserver.d @@ -31,6 +31,9 @@ #include #endif +typedef const uint8_t *const_uint8_p; +typedef const double *const_double_p; + provider Xserver { /* reqType, data, length, client id, request buffer */ probe request__start(string, uint8_t, uint16_t, int, void *); @@ -49,7 +52,7 @@ provider Xserver { /* client id, event type, event* */ probe send__event(int, uint8_t, void *); /* deviceid, type, button/keycode/touchid, flags, nvalues, mask, values */ - probe input__event(int, int, uint32_t, uint32_t, int8_t, uint8_t*, double*); + probe input__event(int, int, uint32_t, uint32_t, int8_t, const_uint8_p, const_double_p); }; #pragma D attributes Unstable/Unstable/Common provider Xserver provider diff --git a/xorg-server/dix/dispatch.c b/xorg-server/dix/dispatch.c index ff59ad237..45bd238ff 100755 --- a/xorg-server/dix/dispatch.c +++ b/xorg-server/dix/dispatch.c @@ -135,10 +135,7 @@ int ProcInitialConnection(); #ifdef XSERVER_DTRACE #include "registry.h" -#include -typedef const char *string; - -#include "Xserver-dtrace.h" +#include "probes.h" #endif #define mskcnt ((MAXCLIENTS + 31) / 32) @@ -2046,6 +2043,9 @@ ProcPutImage(ClientPtr client) tmpImage = (char *) &stuff[1]; lengthProto = length; + if (stuff->height != 0 && lengthProto >= (INT32_MAX / stuff->height)) + return BadLength; + if ((bytes_to_int32(lengthProto * stuff->height) + bytes_to_int32(sizeof(xPutImageReq))) != client->req_len) return BadLength; diff --git a/xorg-server/dix/events.c b/xorg-server/dix/events.c index e3f5e2372..60712f00c 100644 --- a/xorg-server/dix/events.c +++ b/xorg-server/dix/events.c @@ -125,13 +125,7 @@ Equipment Corporation. #include #include "xkbsrv.h" #include "xace.h" - -#ifdef XSERVER_DTRACE -#include -typedef const char *string; - -#include "Xserver-dtrace.h" -#endif +#include "probes.h" #include #include diff --git a/xorg-server/dix/getevents.c b/xorg-server/dix/getevents.c index 2c4287b01..5e6963fe4 100644 --- a/xorg-server/dix/getevents.c +++ b/xorg-server/dix/getevents.c @@ -68,12 +68,7 @@ #include "exevents.h" #include "extnsionst.h" #include "listdev.h" /* for sizing up DeviceClassesChangedEvent */ - -#if XSERVER_DTRACE -#include -typedef const char *string; -#include -#endif +#include "probes.h" #ifdef _MSC_VER #include @@ -2060,7 +2055,7 @@ GetTouchEvents(InternalEvent *events, DeviceIntPtr dev, uint32_t ddx_touchid, event->root = scr->root->drawable.id; - event_set_root_coordinates(event, screenx, screeny); + event_set_root_coordinates(event, screenx - scr->x, screeny - scr->y); event->touchid = client_id; event->flags = flags; @@ -2098,8 +2093,8 @@ GetDixTouchEnd(InternalEvent *ievent, DeviceIntPtr dev, TouchPointInfoPtr ti, /* Get screen event coordinates from the sprite. Is this really the best * we can do? */ event_set_root_coordinates(event, - dev->last.valuators[0], - dev->last.valuators[1]); + dev->last.valuators[0] - scr->x, + dev->last.valuators[1] - scr->y); event->touchid = ti->client_id; event->flags = flags; diff --git a/xorg-server/dix/region.c b/xorg-server/dix/region.c index ce1014ef8..04e590170 100644 --- a/xorg-server/dix/region.c +++ b/xorg-server/dix/region.c @@ -169,7 +169,6 @@ Equipment Corporation. ((r1)->y1 <= (r2)->y1) && \ ((r1)->y2 >= (r2)->y2) ) -#define xallocData(n) malloc(RegionSizeof(n)) #define xfreeData(reg) if ((reg)->data && (reg)->data->size) free((reg)->data) #define RECTALLOC_BAIL(pReg,n,bail) \ @@ -205,8 +204,9 @@ if (!(pReg)->data || (((pReg)->data->numRects + (n)) > (pReg)->data->size)) \ #define DOWNSIZE(reg,numRects) \ if (((numRects) < ((reg)->data->size >> 1)) && ((reg)->data->size > 50)) \ { \ - RegDataPtr NewData; \ - NewData = (RegDataPtr)realloc((reg)->data, RegionSizeof(numRects)); \ + size_t NewSize = RegionSizeof(numRects); \ + RegDataPtr NewData = \ + (NewSize > 0) ? realloc((reg)->data, NewSize) : NULL ; \ if (NewData) \ { \ NewData->size = (numRects); \ @@ -345,17 +345,20 @@ Bool RegionRectAlloc(RegionPtr pRgn, int n) { RegDataPtr data; + size_t rgnSize; if (!pRgn->data) { n++; - pRgn->data = xallocData(n); + rgnSize = RegionSizeof(n); + pRgn->data = (rgnSize > 0) ? malloc(rgnSize) : NULL; if (!pRgn->data) return RegionBreak(pRgn); pRgn->data->numRects = 1; *RegionBoxptr(pRgn) = pRgn->extents; } else if (!pRgn->data->size) { - pRgn->data = xallocData(n); + rgnSize = RegionSizeof(n); + pRgn->data = (rgnSize > 0) ? malloc(rgnSize) : NULL; if (!pRgn->data) return RegionBreak(pRgn); pRgn->data->numRects = 0; @@ -367,7 +370,8 @@ RegionRectAlloc(RegionPtr pRgn, int n) n = 250; } n += pRgn->data->numRects; - data = (RegDataPtr) realloc(pRgn->data, RegionSizeof(n)); + rgnSize = RegionSizeof(n); + data = (rgnSize > 0) ? realloc(pRgn->data, rgnSize) : NULL; if (!data) return RegionBreak(pRgn); pRgn->data = data; @@ -1312,6 +1316,7 @@ RegionFromRects(int nrects, xRectangle *prect, int ctype) { RegionPtr pRgn; + size_t rgnSize; RegDataPtr pData; BoxPtr pBox; int i; @@ -1338,7 +1343,8 @@ RegionFromRects(int nrects, xRectangle *prect, int ctype) } return pRgn; } - pData = xallocData(nrects); + rgnSize = RegionSizeof(nrects); + pData = (rgnSize > 0) ? malloc(rgnSize) : NULL; if (!pData) { RegionBreak(pRgn); return pRgn; diff --git a/xorg-server/dix/resource.c b/xorg-server/dix/resource.c index 297348ad2..2bec75ac7 100644 --- a/xorg-server/dix/resource.c +++ b/xorg-server/dix/resource.c @@ -144,10 +144,7 @@ Equipment Corporation. #include "gcstruct.h" #ifdef XSERVER_DTRACE -#include -typedef const char *string; - -#include "Xserver-dtrace.h" +#include "probes.h" #define TypeNameString(t) LookupResourceName(t) #endif -- cgit v1.2.3