idx
int64
func_before
string
Vulnerability Classification
string
vul
int64
func_after
string
patch
string
CWE ID
string
lines_before
string
lines_after
string
3,800
AllowSome(ClientPtr client, TimeStamp time, DeviceIntPtr thisDev, int newState) { Bool thisGrabbed, otherGrabbed, othersFrozen, thisSynced; TimeStamp grabTime; DeviceIntPtr dev; GrabInfoPtr devgrabinfo, grabinfo = &thisDev->deviceGrab; thisGrabbed = grabinfo->grab && SameClient(grabinfo->grab, client); thisSynced = FALSE; otherGrabbed = FALSE; othersFrozen = FALSE; grabTime = grabinfo->grabTime; for (dev = inputInfo.devices; dev; dev = dev->next) { devgrabinfo = &dev->deviceGrab; if (dev == thisDev) continue; if (devgrabinfo->grab && SameClient(devgrabinfo->grab, client)) { if (!(thisGrabbed || otherGrabbed) || (CompareTimeStamps(devgrabinfo->grabTime, grabTime) == LATER)) grabTime = devgrabinfo->grabTime; otherGrabbed = TRUE; if (grabinfo->sync.other == devgrabinfo->grab) thisSynced = TRUE; if (devgrabinfo->sync.state >= FROZEN) othersFrozen = TRUE; } } if (!((thisGrabbed && grabinfo->sync.state >= FROZEN) || thisSynced)) return; if ((CompareTimeStamps(time, currentTime) == LATER) || (CompareTimeStamps(time, grabTime) == EARLIER)) return; switch (newState) { case THAWED: /* Async */ if (thisGrabbed) grabinfo->sync.state = THAWED; if (thisSynced) grabinfo->sync.other = NullGrab; ComputeFreezes(); break; case FREEZE_NEXT_EVENT: /* Sync */ if (thisGrabbed) { grabinfo->sync.state = FREEZE_NEXT_EVENT; if (thisSynced) grabinfo->sync.other = NullGrab; ComputeFreezes(); } break; case THAWED_BOTH: /* AsyncBoth */ if (othersFrozen) { for (dev = inputInfo.devices; dev; dev = dev->next) { devgrabinfo = &dev->deviceGrab; if (devgrabinfo->grab && SameClient(devgrabinfo->grab, client)) devgrabinfo->sync.state = THAWED; if (devgrabinfo->sync.other && SameClient(devgrabinfo->sync.other, client)) devgrabinfo->sync.other = NullGrab; } ComputeFreezes(); } break; case FREEZE_BOTH_NEXT_EVENT: /* SyncBoth */ if (othersFrozen) { for (dev = inputInfo.devices; dev; dev = dev->next) { devgrabinfo = &dev->deviceGrab; if (devgrabinfo->grab && SameClient(devgrabinfo->grab, client)) devgrabinfo->sync.state = FREEZE_BOTH_NEXT_EVENT; if (devgrabinfo->sync.other && SameClient(devgrabinfo->sync.other, client)) devgrabinfo->sync.other = NullGrab; } ComputeFreezes(); } break; case NOT_GRABBED: /* Replay */ if (thisGrabbed && grabinfo->sync.state == FROZEN_WITH_EVENT) { if (thisSynced) grabinfo->sync.other = NullGrab; syncEvents.replayDev = thisDev; syncEvents.replayWin = grabinfo->grab->window; (*grabinfo->DeactivateGrab) (thisDev); syncEvents.replayDev = (DeviceIntPtr) NULL; } break; case THAW_OTHERS: /* AsyncOthers */ if (othersFrozen) { for (dev = inputInfo.devices; dev; dev = dev->next) { if (dev == thisDev) continue; devgrabinfo = &dev->deviceGrab; if (devgrabinfo->grab && SameClient(devgrabinfo->grab, client)) devgrabinfo->sync.state = THAWED; if (devgrabinfo->sync.other && SameClient(devgrabinfo->sync.other, client)) devgrabinfo->sync.other = NullGrab; } ComputeFreezes(); } break; } /* We've unfrozen the grab. If the grab was a touch grab, we're now the * owner and expected to accept/reject it. Reject == ReplayPointer which * we've handled in ComputeFreezes() (during DeactivateGrab) above, * anything else is accept. */ if (newState != NOT_GRABBED /* Replay */ && IsTouchEvent((InternalEvent*)grabinfo->sync.event)) { TouchAcceptAndEnd(thisDev, grabinfo->sync.event->touchid); } }
Exec Code Overflow
0
AllowSome(ClientPtr client, TimeStamp time, DeviceIntPtr thisDev, int newState) { Bool thisGrabbed, otherGrabbed, othersFrozen, thisSynced; TimeStamp grabTime; DeviceIntPtr dev; GrabInfoPtr devgrabinfo, grabinfo = &thisDev->deviceGrab; thisGrabbed = grabinfo->grab && SameClient(grabinfo->grab, client); thisSynced = FALSE; otherGrabbed = FALSE; othersFrozen = FALSE; grabTime = grabinfo->grabTime; for (dev = inputInfo.devices; dev; dev = dev->next) { devgrabinfo = &dev->deviceGrab; if (dev == thisDev) continue; if (devgrabinfo->grab && SameClient(devgrabinfo->grab, client)) { if (!(thisGrabbed || otherGrabbed) || (CompareTimeStamps(devgrabinfo->grabTime, grabTime) == LATER)) grabTime = devgrabinfo->grabTime; otherGrabbed = TRUE; if (grabinfo->sync.other == devgrabinfo->grab) thisSynced = TRUE; if (devgrabinfo->sync.state >= FROZEN) othersFrozen = TRUE; } } if (!((thisGrabbed && grabinfo->sync.state >= FROZEN) || thisSynced)) return; if ((CompareTimeStamps(time, currentTime) == LATER) || (CompareTimeStamps(time, grabTime) == EARLIER)) return; switch (newState) { case THAWED: /* Async */ if (thisGrabbed) grabinfo->sync.state = THAWED; if (thisSynced) grabinfo->sync.other = NullGrab; ComputeFreezes(); break; case FREEZE_NEXT_EVENT: /* Sync */ if (thisGrabbed) { grabinfo->sync.state = FREEZE_NEXT_EVENT; if (thisSynced) grabinfo->sync.other = NullGrab; ComputeFreezes(); } break; case THAWED_BOTH: /* AsyncBoth */ if (othersFrozen) { for (dev = inputInfo.devices; dev; dev = dev->next) { devgrabinfo = &dev->deviceGrab; if (devgrabinfo->grab && SameClient(devgrabinfo->grab, client)) devgrabinfo->sync.state = THAWED; if (devgrabinfo->sync.other && SameClient(devgrabinfo->sync.other, client)) devgrabinfo->sync.other = NullGrab; } ComputeFreezes(); } break; case FREEZE_BOTH_NEXT_EVENT: /* SyncBoth */ if (othersFrozen) { for (dev = inputInfo.devices; dev; dev = dev->next) { devgrabinfo = &dev->deviceGrab; if (devgrabinfo->grab && SameClient(devgrabinfo->grab, client)) devgrabinfo->sync.state = FREEZE_BOTH_NEXT_EVENT; if (devgrabinfo->sync.other && SameClient(devgrabinfo->sync.other, client)) devgrabinfo->sync.other = NullGrab; } ComputeFreezes(); } break; case NOT_GRABBED: /* Replay */ if (thisGrabbed && grabinfo->sync.state == FROZEN_WITH_EVENT) { if (thisSynced) grabinfo->sync.other = NullGrab; syncEvents.replayDev = thisDev; syncEvents.replayWin = grabinfo->grab->window; (*grabinfo->DeactivateGrab) (thisDev); syncEvents.replayDev = (DeviceIntPtr) NULL; } break; case THAW_OTHERS: /* AsyncOthers */ if (othersFrozen) { for (dev = inputInfo.devices; dev; dev = dev->next) { if (dev == thisDev) continue; devgrabinfo = &dev->deviceGrab; if (devgrabinfo->grab && SameClient(devgrabinfo->grab, client)) devgrabinfo->sync.state = THAWED; if (devgrabinfo->sync.other && SameClient(devgrabinfo->sync.other, client)) devgrabinfo->sync.other = NullGrab; } ComputeFreezes(); } break; } /* We've unfrozen the grab. If the grab was a touch grab, we're now the * owner and expected to accept/reject it. Reject == ReplayPointer which * we've handled in ComputeFreezes() (during DeactivateGrab) above, * anything else is accept. */ if (newState != NOT_GRABBED /* Replay */ && IsTouchEvent((InternalEvent*)grabinfo->sync.event)) { TouchAcceptAndEnd(thisDev, grabinfo->sync.event->touchid); } }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,801
CheckCursorConfinement(WindowPtr pWin) { GrabPtr grab; WindowPtr confineTo; DeviceIntPtr pDev; #ifdef PANORAMIX if (!noPanoramiXExtension && pWin->drawable.pScreen->myNum) return; #endif for (pDev = inputInfo.devices; pDev; pDev = pDev->next) { if (DevHasCursor(pDev)) { grab = pDev->deviceGrab.grab; if (grab && (confineTo = grab->confineTo)) { if (!BorderSizeNotEmpty(pDev, confineTo)) (*pDev->deviceGrab.DeactivateGrab) (pDev); else if ((pWin == confineTo) || IsParent(pWin, confineTo)) ConfineCursorToWindow(pDev, confineTo, TRUE, TRUE); } } } }
Exec Code Overflow
0
CheckCursorConfinement(WindowPtr pWin) { GrabPtr grab; WindowPtr confineTo; DeviceIntPtr pDev; #ifdef PANORAMIX if (!noPanoramiXExtension && pWin->drawable.pScreen->myNum) return; #endif for (pDev = inputInfo.devices; pDev; pDev = pDev->next) { if (DevHasCursor(pDev)) { grab = pDev->deviceGrab.grab; if (grab && (confineTo = grab->confineTo)) { if (!BorderSizeNotEmpty(pDev, confineTo)) (*pDev->deviceGrab.DeactivateGrab) (pDev); else if ((pWin == confineTo) || IsParent(pWin, confineTo)) ConfineCursorToWindow(pDev, confineTo, TRUE, TRUE); } } } }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,802
CheckDeviceGrabs(DeviceIntPtr device, DeviceEvent *event, WindowPtr ancestor) { int i; WindowPtr pWin = NULL; FocusClassPtr focus = IsPointerEvent((InternalEvent *) event) ? NULL : device->focus; BOOL sendCore = (IsMaster(device) && device->coreEvents); Bool ret = FALSE; if (event->type != ET_ButtonPress && event->type != ET_KeyPress) return FALSE; if (event->type == ET_ButtonPress && (device->button->buttonsDown != 1)) return FALSE; if (device->deviceGrab.grab) return FALSE; i = 0; if (ancestor) { while (i < device->spriteInfo->sprite->spriteTraceGood) if (device->spriteInfo->sprite->spriteTrace[i++] == ancestor) break; if (i == device->spriteInfo->sprite->spriteTraceGood) goto out; } if (focus) { for (; i < focus->traceGood; i++) { pWin = focus->trace[i]; if (CheckPassiveGrabsOnWindow(pWin, device, (InternalEvent *) event, sendCore, TRUE)) { ret = TRUE; goto out; } } if ((focus->win == NoneWin) || (i >= device->spriteInfo->sprite->spriteTraceGood) || (pWin && pWin != device->spriteInfo->sprite->spriteTrace[i - 1])) goto out; } for (; i < device->spriteInfo->sprite->spriteTraceGood; i++) { pWin = device->spriteInfo->sprite->spriteTrace[i]; if (CheckPassiveGrabsOnWindow(pWin, device, (InternalEvent *) event, sendCore, TRUE)) { ret = TRUE; goto out; } } out: if (ret == TRUE && event->type == ET_KeyPress) device->deviceGrab.activatingKey = event->detail.key; return ret; }
Exec Code Overflow
0
CheckDeviceGrabs(DeviceIntPtr device, DeviceEvent *event, WindowPtr ancestor) { int i; WindowPtr pWin = NULL; FocusClassPtr focus = IsPointerEvent((InternalEvent *) event) ? NULL : device->focus; BOOL sendCore = (IsMaster(device) && device->coreEvents); Bool ret = FALSE; if (event->type != ET_ButtonPress && event->type != ET_KeyPress) return FALSE; if (event->type == ET_ButtonPress && (device->button->buttonsDown != 1)) return FALSE; if (device->deviceGrab.grab) return FALSE; i = 0; if (ancestor) { while (i < device->spriteInfo->sprite->spriteTraceGood) if (device->spriteInfo->sprite->spriteTrace[i++] == ancestor) break; if (i == device->spriteInfo->sprite->spriteTraceGood) goto out; } if (focus) { for (; i < focus->traceGood; i++) { pWin = focus->trace[i]; if (CheckPassiveGrabsOnWindow(pWin, device, (InternalEvent *) event, sendCore, TRUE)) { ret = TRUE; goto out; } } if ((focus->win == NoneWin) || (i >= device->spriteInfo->sprite->spriteTraceGood) || (pWin && pWin != device->spriteInfo->sprite->spriteTrace[i - 1])) goto out; } for (; i < device->spriteInfo->sprite->spriteTraceGood; i++) { pWin = device->spriteInfo->sprite->spriteTrace[i]; if (CheckPassiveGrabsOnWindow(pWin, device, (InternalEvent *) event, sendCore, TRUE)) { ret = TRUE; goto out; } } out: if (ret == TRUE && event->type == ET_KeyPress) device->deviceGrab.activatingKey = event->detail.key; return ret; }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,803
CheckGrabForSyncs(DeviceIntPtr thisDev, Bool thisMode, Bool otherMode) { GrabPtr grab = thisDev->deviceGrab.grab; DeviceIntPtr dev; if (thisMode == GrabModeSync) thisDev->deviceGrab.sync.state = FROZEN_NO_EVENT; else { /* free both if same client owns both */ thisDev->deviceGrab.sync.state = THAWED; if (thisDev->deviceGrab.sync.other && (CLIENT_BITS(thisDev->deviceGrab.sync.other->resource) == CLIENT_BITS(grab->resource))) thisDev->deviceGrab.sync.other = NullGrab; } if (IsMaster(thisDev)) { dev = GetPairedDevice(thisDev); if (otherMode == GrabModeSync) dev->deviceGrab.sync.other = grab; else { /* free both if same client owns both */ if (dev->deviceGrab.sync.other && (CLIENT_BITS(dev->deviceGrab.sync.other->resource) == CLIENT_BITS(grab->resource))) dev->deviceGrab.sync.other = NullGrab; } } ComputeFreezes(); }
Exec Code Overflow
0
CheckGrabForSyncs(DeviceIntPtr thisDev, Bool thisMode, Bool otherMode) { GrabPtr grab = thisDev->deviceGrab.grab; DeviceIntPtr dev; if (thisMode == GrabModeSync) thisDev->deviceGrab.sync.state = FROZEN_NO_EVENT; else { /* free both if same client owns both */ thisDev->deviceGrab.sync.state = THAWED; if (thisDev->deviceGrab.sync.other && (CLIENT_BITS(thisDev->deviceGrab.sync.other->resource) == CLIENT_BITS(grab->resource))) thisDev->deviceGrab.sync.other = NullGrab; } if (IsMaster(thisDev)) { dev = GetPairedDevice(thisDev); if (otherMode == GrabModeSync) dev->deviceGrab.sync.other = grab; else { /* free both if same client owns both */ if (dev->deviceGrab.sync.other && (CLIENT_BITS(dev->deviceGrab.sync.other->resource) == CLIENT_BITS(grab->resource))) dev->deviceGrab.sync.other = NullGrab; } } ComputeFreezes(); }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,804
CheckMotion(DeviceEvent *ev, DeviceIntPtr pDev) { WindowPtr prevSpriteWin, newSpriteWin; SpritePtr pSprite = pDev->spriteInfo->sprite; verify_internal_event((InternalEvent *) ev); prevSpriteWin = pSprite->win; if (ev && !syncEvents.playingEvents) { /* GetPointerEvents() guarantees that pointer events have the correct rootX/Y set already. */ switch (ev->type) { case ET_ButtonPress: case ET_ButtonRelease: case ET_Motion: case ET_TouchBegin: case ET_TouchUpdate: case ET_TouchEnd: break; default: /* all other events return FALSE */ return FALSE; } #ifdef PANORAMIX if (!noPanoramiXExtension) { /* Motion events entering DIX get translated to Screen 0 coordinates. Replayed events have already been translated since they've entered DIX before */ ev->root_x += pSprite->screen->x - screenInfo.screens[0]->x; ev->root_y += pSprite->screen->y - screenInfo.screens[0]->y; } else #endif { if (pSprite->hot.pScreen != pSprite->hotPhys.pScreen) { pSprite->hot.pScreen = pSprite->hotPhys.pScreen; RootWindow(pDev->spriteInfo->sprite) = pSprite->hot.pScreen->root; } } pSprite->hot.x = ev->root_x; pSprite->hot.y = ev->root_y; if (pSprite->hot.x < pSprite->physLimits.x1) pSprite->hot.x = pSprite->physLimits.x1; else if (pSprite->hot.x >= pSprite->physLimits.x2) pSprite->hot.x = pSprite->physLimits.x2 - 1; if (pSprite->hot.y < pSprite->physLimits.y1) pSprite->hot.y = pSprite->physLimits.y1; else if (pSprite->hot.y >= pSprite->physLimits.y2) pSprite->hot.y = pSprite->physLimits.y2 - 1; if (pSprite->hotShape) ConfineToShape(pDev, pSprite->hotShape, &pSprite->hot.x, &pSprite->hot.y); pSprite->hotPhys = pSprite->hot; if ((pSprite->hotPhys.x != ev->root_x) || (pSprite->hotPhys.y != ev->root_y)) { #ifdef PANORAMIX if (!noPanoramiXExtension) { XineramaSetCursorPosition(pDev, pSprite->hotPhys.x, pSprite->hotPhys.y, FALSE); } else #endif { (*pSprite->hotPhys.pScreen->SetCursorPosition) (pDev, pSprite-> hotPhys.pScreen, pSprite-> hotPhys.x, pSprite-> hotPhys.y, FALSE); } } ev->root_x = pSprite->hot.x; ev->root_y = pSprite->hot.y; } newSpriteWin = XYToWindow(pSprite, pSprite->hot.x, pSprite->hot.y); if (newSpriteWin != prevSpriteWin) { int sourceid; if (!ev) { UpdateCurrentTimeIf(); sourceid = pDev->id; /* when from WindowsRestructured */ } else sourceid = ev->sourceid; if (prevSpriteWin != NullWindow) { if (!ActivateEnterGrab(pDev, prevSpriteWin, newSpriteWin)) DoEnterLeaveEvents(pDev, sourceid, prevSpriteWin, newSpriteWin, NotifyNormal); } /* set pSprite->win after ActivateEnterGrab, otherwise sprite window == grab_window and no enter/leave events are sent. */ pSprite->win = newSpriteWin; PostNewCursor(pDev); return FALSE; } return TRUE; }
Exec Code Overflow
0
CheckMotion(DeviceEvent *ev, DeviceIntPtr pDev) { WindowPtr prevSpriteWin, newSpriteWin; SpritePtr pSprite = pDev->spriteInfo->sprite; verify_internal_event((InternalEvent *) ev); prevSpriteWin = pSprite->win; if (ev && !syncEvents.playingEvents) { /* GetPointerEvents() guarantees that pointer events have the correct rootX/Y set already. */ switch (ev->type) { case ET_ButtonPress: case ET_ButtonRelease: case ET_Motion: case ET_TouchBegin: case ET_TouchUpdate: case ET_TouchEnd: break; default: /* all other events return FALSE */ return FALSE; } #ifdef PANORAMIX if (!noPanoramiXExtension) { /* Motion events entering DIX get translated to Screen 0 coordinates. Replayed events have already been translated since they've entered DIX before */ ev->root_x += pSprite->screen->x - screenInfo.screens[0]->x; ev->root_y += pSprite->screen->y - screenInfo.screens[0]->y; } else #endif { if (pSprite->hot.pScreen != pSprite->hotPhys.pScreen) { pSprite->hot.pScreen = pSprite->hotPhys.pScreen; RootWindow(pDev->spriteInfo->sprite) = pSprite->hot.pScreen->root; } } pSprite->hot.x = ev->root_x; pSprite->hot.y = ev->root_y; if (pSprite->hot.x < pSprite->physLimits.x1) pSprite->hot.x = pSprite->physLimits.x1; else if (pSprite->hot.x >= pSprite->physLimits.x2) pSprite->hot.x = pSprite->physLimits.x2 - 1; if (pSprite->hot.y < pSprite->physLimits.y1) pSprite->hot.y = pSprite->physLimits.y1; else if (pSprite->hot.y >= pSprite->physLimits.y2) pSprite->hot.y = pSprite->physLimits.y2 - 1; if (pSprite->hotShape) ConfineToShape(pDev, pSprite->hotShape, &pSprite->hot.x, &pSprite->hot.y); pSprite->hotPhys = pSprite->hot; if ((pSprite->hotPhys.x != ev->root_x) || (pSprite->hotPhys.y != ev->root_y)) { #ifdef PANORAMIX if (!noPanoramiXExtension) { XineramaSetCursorPosition(pDev, pSprite->hotPhys.x, pSprite->hotPhys.y, FALSE); } else #endif { (*pSprite->hotPhys.pScreen->SetCursorPosition) (pDev, pSprite-> hotPhys.pScreen, pSprite-> hotPhys.x, pSprite-> hotPhys.y, FALSE); } } ev->root_x = pSprite->hot.x; ev->root_y = pSprite->hot.y; } newSpriteWin = XYToWindow(pSprite, pSprite->hot.x, pSprite->hot.y); if (newSpriteWin != prevSpriteWin) { int sourceid; if (!ev) { UpdateCurrentTimeIf(); sourceid = pDev->id; /* when from WindowsRestructured */ } else sourceid = ev->sourceid; if (prevSpriteWin != NullWindow) { if (!ActivateEnterGrab(pDev, prevSpriteWin, newSpriteWin)) DoEnterLeaveEvents(pDev, sourceid, prevSpriteWin, newSpriteWin, NotifyNormal); } /* set pSprite->win after ActivateEnterGrab, otherwise sprite window == grab_window and no enter/leave events are sent. */ pSprite->win = newSpriteWin; PostNewCursor(pDev); return FALSE; } return TRUE; }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,805
CheckPassiveGrabsOnWindow(WindowPtr pWin, DeviceIntPtr device, InternalEvent *event, BOOL checkCore, BOOL activate) { GrabPtr grab = wPassiveGrabs(pWin); GrabPtr tempGrab; if (!grab) return NULL; tempGrab = AllocGrab(NULL); if (tempGrab == NULL) return NULL; /* Fill out the grab details, but leave the type for later before * comparing */ switch (event->any.type) { case ET_KeyPress: case ET_KeyRelease: tempGrab->detail.exact = event->device_event.detail.key; break; case ET_ButtonPress: case ET_ButtonRelease: case ET_TouchBegin: case ET_TouchEnd: tempGrab->detail.exact = event->device_event.detail.button; break; default: tempGrab->detail.exact = 0; break; } tempGrab->window = pWin; tempGrab->device = device; tempGrab->detail.pMask = NULL; tempGrab->modifiersDetail.pMask = NULL; tempGrab->next = NULL; for (; grab; grab = grab->next) { if (!CheckPassiveGrab(device, grab, event, checkCore, tempGrab)) continue; if (activate && !ActivatePassiveGrab(device, grab, event, event)) continue; break; } FreeGrab(tempGrab); return grab; }
Exec Code Overflow
0
CheckPassiveGrabsOnWindow(WindowPtr pWin, DeviceIntPtr device, InternalEvent *event, BOOL checkCore, BOOL activate) { GrabPtr grab = wPassiveGrabs(pWin); GrabPtr tempGrab; if (!grab) return NULL; tempGrab = AllocGrab(NULL); if (tempGrab == NULL) return NULL; /* Fill out the grab details, but leave the type for later before * comparing */ switch (event->any.type) { case ET_KeyPress: case ET_KeyRelease: tempGrab->detail.exact = event->device_event.detail.key; break; case ET_ButtonPress: case ET_ButtonRelease: case ET_TouchBegin: case ET_TouchEnd: tempGrab->detail.exact = event->device_event.detail.button; break; default: tempGrab->detail.exact = 0; break; } tempGrab->window = pWin; tempGrab->device = device; tempGrab->detail.pMask = NULL; tempGrab->modifiersDetail.pMask = NULL; tempGrab->next = NULL; for (; grab; grab = grab->next) { if (!CheckPassiveGrab(device, grab, event, checkCore, tempGrab)) continue; if (activate && !ActivatePassiveGrab(device, grab, event, event)) continue; break; } FreeGrab(tempGrab); return grab; }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,806
CheckPhysLimits(DeviceIntPtr pDev, CursorPtr cursor, Bool generateEvents, Bool confineToScreen, /* unused if PanoramiX on */ ScreenPtr pScreen) /* unused if PanoramiX on */ { HotSpot new; SpritePtr pSprite = pDev->spriteInfo->sprite; if (!cursor) return; new = pSprite->hotPhys; #ifdef PANORAMIX if (!noPanoramiXExtension) /* I don't care what the DDX has to say about it */ pSprite->physLimits = pSprite->hotLimits; else #endif { if (pScreen) new.pScreen = pScreen; else pScreen = new.pScreen; (*pScreen->CursorLimits) (pDev, pScreen, cursor, &pSprite->hotLimits, &pSprite->physLimits); pSprite->confined = confineToScreen; (*pScreen->ConstrainCursor) (pDev, pScreen, &pSprite->physLimits); } /* constrain the pointer to those limits */ if (new.x < pSprite->physLimits.x1) new.x = pSprite->physLimits.x1; else if (new.x >= pSprite->physLimits.x2) new.x = pSprite->physLimits.x2 - 1; if (new.y < pSprite->physLimits.y1) new.y = pSprite->physLimits.y1; else if (new.y >= pSprite->physLimits.y2) new.y = pSprite->physLimits.y2 - 1; if (pSprite->hotShape) ConfineToShape(pDev, pSprite->hotShape, &new.x, &new.y); if (( #ifdef PANORAMIX noPanoramiXExtension && #endif (pScreen != pSprite->hotPhys.pScreen)) || (new.x != pSprite->hotPhys.x) || (new.y != pSprite->hotPhys.y)) { #ifdef PANORAMIX if (!noPanoramiXExtension) XineramaSetCursorPosition(pDev, new.x, new.y, generateEvents); else #endif { if (pScreen != pSprite->hotPhys.pScreen) pSprite->hotPhys = new; (*pScreen->SetCursorPosition) (pDev, pScreen, new.x, new.y, generateEvents); } if (!generateEvents) SyntheticMotion(pDev, new.x, new.y); } #ifdef PANORAMIX /* Tell DDX what the limits are */ if (!noPanoramiXExtension) XineramaConstrainCursor(pDev); #endif }
Exec Code Overflow
0
CheckPhysLimits(DeviceIntPtr pDev, CursorPtr cursor, Bool generateEvents, Bool confineToScreen, /* unused if PanoramiX on */ ScreenPtr pScreen) /* unused if PanoramiX on */ { HotSpot new; SpritePtr pSprite = pDev->spriteInfo->sprite; if (!cursor) return; new = pSprite->hotPhys; #ifdef PANORAMIX if (!noPanoramiXExtension) /* I don't care what the DDX has to say about it */ pSprite->physLimits = pSprite->hotLimits; else #endif { if (pScreen) new.pScreen = pScreen; else pScreen = new.pScreen; (*pScreen->CursorLimits) (pDev, pScreen, cursor, &pSprite->hotLimits, &pSprite->physLimits); pSprite->confined = confineToScreen; (*pScreen->ConstrainCursor) (pDev, pScreen, &pSprite->physLimits); } /* constrain the pointer to those limits */ if (new.x < pSprite->physLimits.x1) new.x = pSprite->physLimits.x1; else if (new.x >= pSprite->physLimits.x2) new.x = pSprite->physLimits.x2 - 1; if (new.y < pSprite->physLimits.y1) new.y = pSprite->physLimits.y1; else if (new.y >= pSprite->physLimits.y2) new.y = pSprite->physLimits.y2 - 1; if (pSprite->hotShape) ConfineToShape(pDev, pSprite->hotShape, &new.x, &new.y); if (( #ifdef PANORAMIX noPanoramiXExtension && #endif (pScreen != pSprite->hotPhys.pScreen)) || (new.x != pSprite->hotPhys.x) || (new.y != pSprite->hotPhys.y)) { #ifdef PANORAMIX if (!noPanoramiXExtension) XineramaSetCursorPosition(pDev, new.x, new.y, generateEvents); else #endif { if (pScreen != pSprite->hotPhys.pScreen) pSprite->hotPhys = new; (*pScreen->SetCursorPosition) (pDev, pScreen, new.x, new.y, generateEvents); } if (!generateEvents) SyntheticMotion(pDev, new.x, new.y); } #ifdef PANORAMIX /* Tell DDX what the limits are */ if (!noPanoramiXExtension) XineramaConstrainCursor(pDev); #endif }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,807
CloseDownEvents(void) { FreeEventList(InputEventList, GetMaximumEventsNum()); InputEventList = NULL; }
Exec Code Overflow
0
CloseDownEvents(void) { FreeEventList(InputEventList, GetMaximumEventsNum()); InputEventList = NULL; }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,808
ConfineCursorToWindow(DeviceIntPtr pDev, WindowPtr pWin, Bool generateEvents, Bool confineToScreen) { SpritePtr pSprite = pDev->spriteInfo->sprite; if (syncEvents.playingEvents) { CheckVirtualMotion(pDev, (QdEventPtr) NULL, pWin); SyntheticMotion(pDev, pSprite->hot.x, pSprite->hot.y); } else { ScreenPtr pScreen = pWin->drawable.pScreen; #ifdef PANORAMIX if (!noPanoramiXExtension) { XineramaConfineCursorToWindow(pDev, pWin, generateEvents); return; } #endif pSprite->hotLimits = *RegionExtents(&pWin->borderSize); pSprite->hotShape = wBoundingShape(pWin) ? &pWin->borderSize : NullRegion; CheckPhysLimits(pDev, pSprite->current, generateEvents, confineToScreen, pWin->drawable.pScreen); if (*pScreen->CursorConfinedTo) (*pScreen->CursorConfinedTo) (pDev, pScreen, pWin); } }
Exec Code Overflow
0
ConfineCursorToWindow(DeviceIntPtr pDev, WindowPtr pWin, Bool generateEvents, Bool confineToScreen) { SpritePtr pSprite = pDev->spriteInfo->sprite; if (syncEvents.playingEvents) { CheckVirtualMotion(pDev, (QdEventPtr) NULL, pWin); SyntheticMotion(pDev, pSprite->hot.x, pSprite->hot.y); } else { ScreenPtr pScreen = pWin->drawable.pScreen; #ifdef PANORAMIX if (!noPanoramiXExtension) { XineramaConfineCursorToWindow(pDev, pWin, generateEvents); return; } #endif pSprite->hotLimits = *RegionExtents(&pWin->borderSize); pSprite->hotShape = wBoundingShape(pWin) ? &pWin->borderSize : NullRegion; CheckPhysLimits(pDev, pSprite->current, generateEvents, confineToScreen, pWin->drawable.pScreen); if (*pScreen->CursorConfinedTo) (*pScreen->CursorConfinedTo) (pDev, pScreen, pWin); } }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,809
ConfineToShape(DeviceIntPtr pDev, RegionPtr shape, int *px, int *py) { BoxRec box; int x = *px, y = *py; int incx = 1, incy = 1; if (RegionContainsPoint(shape, x, y, &box)) return; box = *RegionExtents(shape); /* this is rather crude */ do { x += incx; if (x >= box.x2) { incx = -1; x = *px - 1; } else if (x < box.x1) { incx = 1; x = *px; y += incy; if (y >= box.y2) { incy = -1; y = *py - 1; } else if (y < box.y1) return; /* should never get here! */ } } while (!RegionContainsPoint(shape, x, y, &box)); *px = x; *py = y; }
Exec Code Overflow
0
ConfineToShape(DeviceIntPtr pDev, RegionPtr shape, int *px, int *py) { BoxRec box; int x = *px, y = *py; int incx = 1, incy = 1; if (RegionContainsPoint(shape, x, y, &box)) return; box = *RegionExtents(shape); /* this is rather crude */ do { x += incx; if (x >= box.x2) { incx = -1; x = *px - 1; } else if (x < box.x1) { incx = 1; x = *px; y += incy; if (y >= box.y2) { incy = -1; y = *py - 1; } else if (y < box.y1) return; /* should never get here! */ } } while (!RegionContainsPoint(shape, x, y, &box)); *px = x; *py = y; }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,810
CoreEnterLeaveEvent(DeviceIntPtr mouse, int type, int mode, int detail, WindowPtr pWin, Window child) { xEvent event = { .u.u.type = type, .u.u.detail = detail }; WindowPtr focus; DeviceIntPtr keybd; GrabPtr grab = mouse->deviceGrab.grab; Mask mask; keybd = GetMaster(mouse, KEYBOARD_OR_FLOAT); if ((pWin == mouse->valuator->motionHintWindow) && (detail != NotifyInferior)) mouse->valuator->motionHintWindow = NullWindow; if (grab) { mask = (pWin == grab->window) ? grab->eventMask : 0; if (grab->ownerEvents) mask |= EventMaskForClient(pWin, rClient(grab)); } else { mask = pWin->eventMask | wOtherEventMasks(pWin); } event.u.enterLeave.time = currentTime.milliseconds; event.u.enterLeave.rootX = mouse->spriteInfo->sprite->hot.x; event.u.enterLeave.rootY = mouse->spriteInfo->sprite->hot.y; /* Counts on the same initial structure of crossing & button events! */ FixUpEventFromWindow(mouse->spriteInfo->sprite, &event, pWin, None, FALSE); /* Enter/Leave events always set child */ event.u.enterLeave.child = child; event.u.enterLeave.flags = event.u.keyButtonPointer.sameScreen ? ELFlagSameScreen : 0; event.u.enterLeave.state = mouse->button ? (mouse->button->state & 0x1f00) : 0; if (keybd) event.u.enterLeave.state |= XkbGrabStateFromRec(&keybd->key->xkbInfo->state); event.u.enterLeave.mode = mode; focus = (keybd) ? keybd->focus->win : None; if ((focus != NoneWin) && ((pWin == focus) || (focus == PointerRootWin) || IsParent(focus, pWin))) event.u.enterLeave.flags |= ELFlagFocus; if ((mask & GetEventFilter(mouse, &event))) { if (grab) TryClientEvents(rClient(grab), mouse, &event, 1, mask, GetEventFilter(mouse, &event), grab); else DeliverEventsToWindow(mouse, pWin, &event, 1, GetEventFilter(mouse, &event), NullGrab); } if ((type == EnterNotify) && (mask & KeymapStateMask)) { xKeymapEvent ke = { .type = KeymapNotify }; ClientPtr client = grab ? rClient(grab) : wClient(pWin); int rc; rc = XaceHook(XACE_DEVICE_ACCESS, client, keybd, DixReadAccess); if (rc == Success) memcpy((char *) &ke.map[0], (char *) &keybd->key->down[1], 31); if (grab) TryClientEvents(rClient(grab), keybd, (xEvent *) &ke, 1, mask, KeymapStateMask, grab); else DeliverEventsToWindow(mouse, pWin, (xEvent *) &ke, 1, KeymapStateMask, NullGrab); } }
Exec Code Overflow
0
CoreEnterLeaveEvent(DeviceIntPtr mouse, int type, int mode, int detail, WindowPtr pWin, Window child) { xEvent event = { .u.u.type = type, .u.u.detail = detail }; WindowPtr focus; DeviceIntPtr keybd; GrabPtr grab = mouse->deviceGrab.grab; Mask mask; keybd = GetMaster(mouse, KEYBOARD_OR_FLOAT); if ((pWin == mouse->valuator->motionHintWindow) && (detail != NotifyInferior)) mouse->valuator->motionHintWindow = NullWindow; if (grab) { mask = (pWin == grab->window) ? grab->eventMask : 0; if (grab->ownerEvents) mask |= EventMaskForClient(pWin, rClient(grab)); } else { mask = pWin->eventMask | wOtherEventMasks(pWin); } event.u.enterLeave.time = currentTime.milliseconds; event.u.enterLeave.rootX = mouse->spriteInfo->sprite->hot.x; event.u.enterLeave.rootY = mouse->spriteInfo->sprite->hot.y; /* Counts on the same initial structure of crossing & button events! */ FixUpEventFromWindow(mouse->spriteInfo->sprite, &event, pWin, None, FALSE); /* Enter/Leave events always set child */ event.u.enterLeave.child = child; event.u.enterLeave.flags = event.u.keyButtonPointer.sameScreen ? ELFlagSameScreen : 0; event.u.enterLeave.state = mouse->button ? (mouse->button->state & 0x1f00) : 0; if (keybd) event.u.enterLeave.state |= XkbGrabStateFromRec(&keybd->key->xkbInfo->state); event.u.enterLeave.mode = mode; focus = (keybd) ? keybd->focus->win : None; if ((focus != NoneWin) && ((pWin == focus) || (focus == PointerRootWin) || IsParent(focus, pWin))) event.u.enterLeave.flags |= ELFlagFocus; if ((mask & GetEventFilter(mouse, &event))) { if (grab) TryClientEvents(rClient(grab), mouse, &event, 1, mask, GetEventFilter(mouse, &event), grab); else DeliverEventsToWindow(mouse, pWin, &event, 1, GetEventFilter(mouse, &event), NullGrab); } if ((type == EnterNotify) && (mask & KeymapStateMask)) { xKeymapEvent ke = { .type = KeymapNotify }; ClientPtr client = grab ? rClient(grab) : wClient(pWin); int rc; rc = XaceHook(XACE_DEVICE_ACCESS, client, keybd, DixReadAccess); if (rc == Success) memcpy((char *) &ke.map[0], (char *) &keybd->key->down[1], 31); if (grab) TryClientEvents(rClient(grab), keybd, (xEvent *) &ke, 1, mask, KeymapStateMask, grab); else DeliverEventsToWindow(mouse, pWin, (xEvent *) &ke, 1, KeymapStateMask, NullGrab); } }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,811
CoreFocusEvent(DeviceIntPtr dev, int type, int mode, int detail, WindowPtr pWin) { xEvent event = { .u.u.type = type, .u.u.detail = detail }; event.u.focus.mode = mode; event.u.focus.window = pWin->drawable.id; DeliverEventsToWindow(dev, pWin, &event, 1, GetEventFilter(dev, &event), NullGrab); if ((type == FocusIn) && ((pWin->eventMask | wOtherEventMasks(pWin)) & KeymapStateMask)) { xKeymapEvent ke = { .type = KeymapNotify }; ClientPtr client = wClient(pWin); int rc; rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixReadAccess); if (rc == Success) memcpy((char *) &ke.map[0], (char *) &dev->key->down[1], 31); DeliverEventsToWindow(dev, pWin, (xEvent *) &ke, 1, KeymapStateMask, NullGrab); } }
Exec Code Overflow
0
CoreFocusEvent(DeviceIntPtr dev, int type, int mode, int detail, WindowPtr pWin) { xEvent event = { .u.u.type = type, .u.u.detail = detail }; event.u.focus.mode = mode; event.u.focus.window = pWin->drawable.id; DeliverEventsToWindow(dev, pWin, &event, 1, GetEventFilter(dev, &event), NullGrab); if ((type == FocusIn) && ((pWin->eventMask | wOtherEventMasks(pWin)) & KeymapStateMask)) { xKeymapEvent ke = { .type = KeymapNotify }; ClientPtr client = wClient(pWin); int rc; rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixReadAccess); if (rc == Success) memcpy((char *) &ke.map[0], (char *) &dev->key->down[1], 31); DeliverEventsToWindow(dev, pWin, (xEvent *) &ke, 1, KeymapStateMask, NullGrab); } }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,812
CoreGrabInterferes(DeviceIntPtr device, GrabPtr grab) { DeviceIntPtr other; BOOL interfering = FALSE; for (other = inputInfo.devices; other; other = other->next) { GrabPtr othergrab = other->deviceGrab.grab; if (othergrab && othergrab->grabtype == CORE && SameClient(grab, rClient(othergrab)) && ((IsPointerDevice(grab->device) && IsPointerDevice(othergrab->device)) || (IsKeyboardDevice(grab->device) && IsKeyboardDevice(othergrab->device)))) { interfering = TRUE; break; } } return interfering; }
Exec Code Overflow
0
CoreGrabInterferes(DeviceIntPtr device, GrabPtr grab) { DeviceIntPtr other; BOOL interfering = FALSE; for (other = inputInfo.devices; other; other = other->next) { GrabPtr othergrab = other->deviceGrab.grab; if (othergrab && othergrab->grabtype == CORE && SameClient(grab, rClient(othergrab)) && ((IsPointerDevice(grab->device) && IsPointerDevice(othergrab->device)) || (IsKeyboardDevice(grab->device) && IsKeyboardDevice(othergrab->device)))) { interfering = TRUE; break; } } return interfering; }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,813
DeactivateKeyboardGrab(DeviceIntPtr keybd) { GrabPtr grab = keybd->deviceGrab.grab; DeviceIntPtr dev; WindowPtr focusWin; Bool wasImplicit = (keybd->deviceGrab.fromPassiveGrab && keybd->deviceGrab.implicitGrab); if (keybd->valuator) keybd->valuator->motionHintWindow = NullWindow; keybd->deviceGrab.grab = NullGrab; keybd->deviceGrab.sync.state = NOT_GRABBED; keybd->deviceGrab.fromPassiveGrab = FALSE; for (dev = inputInfo.devices; dev; dev = dev->next) { if (dev->deviceGrab.sync.other == grab) dev->deviceGrab.sync.other = NullGrab; } if (keybd->focus) focusWin = keybd->focus->win; else if (keybd->spriteInfo->sprite) focusWin = keybd->spriteInfo->sprite->win; else focusWin = NullWindow; if (focusWin == FollowKeyboardWin) focusWin = inputInfo.keyboard->focus->win; DoFocusEvents(keybd, grab->window, focusWin, NotifyUngrab); if (!wasImplicit && grab->grabtype == XI2) ReattachToOldMaster(keybd); ComputeFreezes(); FreeGrab(grab); }
Exec Code Overflow
0
DeactivateKeyboardGrab(DeviceIntPtr keybd) { GrabPtr grab = keybd->deviceGrab.grab; DeviceIntPtr dev; WindowPtr focusWin; Bool wasImplicit = (keybd->deviceGrab.fromPassiveGrab && keybd->deviceGrab.implicitGrab); if (keybd->valuator) keybd->valuator->motionHintWindow = NullWindow; keybd->deviceGrab.grab = NullGrab; keybd->deviceGrab.sync.state = NOT_GRABBED; keybd->deviceGrab.fromPassiveGrab = FALSE; for (dev = inputInfo.devices; dev; dev = dev->next) { if (dev->deviceGrab.sync.other == grab) dev->deviceGrab.sync.other = NullGrab; } if (keybd->focus) focusWin = keybd->focus->win; else if (keybd->spriteInfo->sprite) focusWin = keybd->spriteInfo->sprite->win; else focusWin = NullWindow; if (focusWin == FollowKeyboardWin) focusWin = inputInfo.keyboard->focus->win; DoFocusEvents(keybd, grab->window, focusWin, NotifyUngrab); if (!wasImplicit && grab->grabtype == XI2) ReattachToOldMaster(keybd); ComputeFreezes(); FreeGrab(grab); }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,814
DeactivatePointerGrab(DeviceIntPtr mouse) { GrabPtr grab = mouse->deviceGrab.grab; DeviceIntPtr dev; Bool wasPassive = mouse->deviceGrab.fromPassiveGrab; Bool wasImplicit = (mouse->deviceGrab.fromPassiveGrab && mouse->deviceGrab.implicitGrab); XID grab_resource = grab->resource; int i; /* If an explicit grab was deactivated, we must remove it from the head of * all the touches' listener lists. */ for (i = 0; !wasPassive && mouse->touch && i < mouse->touch->num_touches; i++) { TouchPointInfoPtr ti = mouse->touch->touches + i; if (ti->active && TouchResourceIsOwner(ti, grab_resource)) { int mode = XIRejectTouch; /* Rejecting will generate a TouchEnd, but we must not emulate a ButtonRelease here. So pretend the listener already has the end event */ if (grab->grabtype == CORE || grab->grabtype == XI || !xi2mask_isset(mouse->deviceGrab.grab->xi2mask, mouse, XI_TouchBegin)) { mode = XIAcceptTouch; /* NOTE: we set the state here, but * ProcessTouchOwnershipEvent() will still call * TouchEmitTouchEnd for this listener. The other half of * this hack is in DeliverTouchEndEvent */ ti->listeners[0].state = LISTENER_HAS_END; } TouchListenerAcceptReject(mouse, ti, 0, mode); } } TouchRemovePointerGrab(mouse); mouse->valuator->motionHintWindow = NullWindow; mouse->deviceGrab.grab = NullGrab; mouse->deviceGrab.sync.state = NOT_GRABBED; mouse->deviceGrab.fromPassiveGrab = FALSE; for (dev = inputInfo.devices; dev; dev = dev->next) { if (dev->deviceGrab.sync.other == grab) dev->deviceGrab.sync.other = NullGrab; } DoEnterLeaveEvents(mouse, mouse->id, grab->window, mouse->spriteInfo->sprite->win, NotifyUngrab); if (grab->confineTo) ConfineCursorToWindow(mouse, GetCurrentRootWindow(mouse), FALSE, FALSE); PostNewCursor(mouse); if (!wasImplicit && grab->grabtype == XI2) ReattachToOldMaster(mouse); ComputeFreezes(); FreeGrab(grab); }
Exec Code Overflow
0
DeactivatePointerGrab(DeviceIntPtr mouse) { GrabPtr grab = mouse->deviceGrab.grab; DeviceIntPtr dev; Bool wasPassive = mouse->deviceGrab.fromPassiveGrab; Bool wasImplicit = (mouse->deviceGrab.fromPassiveGrab && mouse->deviceGrab.implicitGrab); XID grab_resource = grab->resource; int i; /* If an explicit grab was deactivated, we must remove it from the head of * all the touches' listener lists. */ for (i = 0; !wasPassive && mouse->touch && i < mouse->touch->num_touches; i++) { TouchPointInfoPtr ti = mouse->touch->touches + i; if (ti->active && TouchResourceIsOwner(ti, grab_resource)) { int mode = XIRejectTouch; /* Rejecting will generate a TouchEnd, but we must not emulate a ButtonRelease here. So pretend the listener already has the end event */ if (grab->grabtype == CORE || grab->grabtype == XI || !xi2mask_isset(mouse->deviceGrab.grab->xi2mask, mouse, XI_TouchBegin)) { mode = XIAcceptTouch; /* NOTE: we set the state here, but * ProcessTouchOwnershipEvent() will still call * TouchEmitTouchEnd for this listener. The other half of * this hack is in DeliverTouchEndEvent */ ti->listeners[0].state = LISTENER_HAS_END; } TouchListenerAcceptReject(mouse, ti, 0, mode); } } TouchRemovePointerGrab(mouse); mouse->valuator->motionHintWindow = NullWindow; mouse->deviceGrab.grab = NullGrab; mouse->deviceGrab.sync.state = NOT_GRABBED; mouse->deviceGrab.fromPassiveGrab = FALSE; for (dev = inputInfo.devices; dev; dev = dev->next) { if (dev->deviceGrab.sync.other == grab) dev->deviceGrab.sync.other = NullGrab; } DoEnterLeaveEvents(mouse, mouse->id, grab->window, mouse->spriteInfo->sprite->win, NotifyUngrab); if (grab->confineTo) ConfineCursorToWindow(mouse, GetCurrentRootWindow(mouse), FALSE, FALSE); PostNewCursor(mouse); if (!wasImplicit && grab->grabtype == XI2) ReattachToOldMaster(mouse); ComputeFreezes(); FreeGrab(grab); }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,815
DeliverDeviceEvents(WindowPtr pWin, InternalEvent *event, GrabPtr grab, WindowPtr stopAt, DeviceIntPtr dev) { Window child = None; int deliveries = 0; int mask; verify_internal_event(event); while (pWin) { if ((mask = EventIsDeliverable(dev, event->any.type, pWin))) { /* XI2 events first */ if (mask & EVENT_XI2_MASK) { deliveries = DeliverOneEvent(event, dev, XI2, pWin, child, grab); if (deliveries > 0) break; } /* XI events */ if (mask & EVENT_XI1_MASK) { deliveries = DeliverOneEvent(event, dev, XI, pWin, child, grab); if (deliveries > 0) break; } /* Core event */ if ((mask & EVENT_CORE_MASK) && IsMaster(dev) && dev->coreEvents) { deliveries = DeliverOneEvent(event, dev, CORE, pWin, child, grab); if (deliveries > 0) break; } } if ((deliveries < 0) || (pWin == stopAt) || (mask & EVENT_DONT_PROPAGATE_MASK)) { deliveries = 0; break; } child = pWin->drawable.id; pWin = pWin->parent; } return deliveries; }
Exec Code Overflow
0
DeliverDeviceEvents(WindowPtr pWin, InternalEvent *event, GrabPtr grab, WindowPtr stopAt, DeviceIntPtr dev) { Window child = None; int deliveries = 0; int mask; verify_internal_event(event); while (pWin) { if ((mask = EventIsDeliverable(dev, event->any.type, pWin))) { /* XI2 events first */ if (mask & EVENT_XI2_MASK) { deliveries = DeliverOneEvent(event, dev, XI2, pWin, child, grab); if (deliveries > 0) break; } /* XI events */ if (mask & EVENT_XI1_MASK) { deliveries = DeliverOneEvent(event, dev, XI, pWin, child, grab); if (deliveries > 0) break; } /* Core event */ if ((mask & EVENT_CORE_MASK) && IsMaster(dev) && dev->coreEvents) { deliveries = DeliverOneEvent(event, dev, CORE, pWin, child, grab); if (deliveries > 0) break; } } if ((deliveries < 0) || (pWin == stopAt) || (mask & EVENT_DONT_PROPAGATE_MASK)) { deliveries = 0; break; } child = pWin->drawable.id; pWin = pWin->parent; } return deliveries; }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,816
DeliverEvent(DeviceIntPtr dev, xEvent *xE, int count, WindowPtr win, Window child, GrabPtr grab) { SpritePtr pSprite = dev->spriteInfo->sprite; Mask filter; int deliveries = 0; if (XaceHook(XACE_SEND_ACCESS, NULL, dev, win, xE, count) == Success) { filter = GetEventFilter(dev, xE); FixUpEventFromWindow(pSprite, xE, win, child, FALSE); deliveries = DeliverEventsToWindow(dev, win, xE, count, filter, grab); } return deliveries; }
Exec Code Overflow
0
DeliverEvent(DeviceIntPtr dev, xEvent *xE, int count, WindowPtr win, Window child, GrabPtr grab) { SpritePtr pSprite = dev->spriteInfo->sprite; Mask filter; int deliveries = 0; if (XaceHook(XACE_SEND_ACCESS, NULL, dev, win, xE, count) == Success) { filter = GetEventFilter(dev, xE); FixUpEventFromWindow(pSprite, xE, win, child, FALSE); deliveries = DeliverEventsToWindow(dev, win, xE, count, filter, grab); } return deliveries; }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,817
DeliverEventToInputClients(DeviceIntPtr dev, InputClients * inputclients, WindowPtr win, xEvent *events, int count, Mask filter, GrabPtr grab, ClientPtr *client_return, Mask *mask_return) { int attempt; enum EventDeliveryState rc = EVENT_NOT_DELIVERED; Bool have_device_button_grab_class_client = FALSE; for (; inputclients; inputclients = inputclients->next) { Mask mask; ClientPtr client = rClient(inputclients); if (IsInterferingGrab(client, dev, events)) continue; if (IsWrongPointerBarrierClient(client, dev, events)) continue; mask = GetEventMask(dev, events, inputclients); if (XaceHook(XACE_RECEIVE_ACCESS, client, win, events, count)) /* do nothing */ ; else if ((attempt = TryClientEvents(client, dev, events, count, mask, filter, grab))) { if (attempt > 0) { /* * The order of clients is arbitrary therefore if one * client belongs to DeviceButtonGrabClass make sure to * catch it. */ if (!have_device_button_grab_class_client) { rc = EVENT_DELIVERED; *client_return = client; *mask_return = mask; /* Success overrides non-success, so if we've been * successful on one client, return that */ if (mask & DeviceButtonGrabMask) have_device_button_grab_class_client = TRUE; } } else if (rc == EVENT_NOT_DELIVERED) rc = EVENT_REJECTED; } } return rc; }
Exec Code Overflow
0
DeliverEventToInputClients(DeviceIntPtr dev, InputClients * inputclients, WindowPtr win, xEvent *events, int count, Mask filter, GrabPtr grab, ClientPtr *client_return, Mask *mask_return) { int attempt; enum EventDeliveryState rc = EVENT_NOT_DELIVERED; Bool have_device_button_grab_class_client = FALSE; for (; inputclients; inputclients = inputclients->next) { Mask mask; ClientPtr client = rClient(inputclients); if (IsInterferingGrab(client, dev, events)) continue; if (IsWrongPointerBarrierClient(client, dev, events)) continue; mask = GetEventMask(dev, events, inputclients); if (XaceHook(XACE_RECEIVE_ACCESS, client, win, events, count)) /* do nothing */ ; else if ((attempt = TryClientEvents(client, dev, events, count, mask, filter, grab))) { if (attempt > 0) { /* * The order of clients is arbitrary therefore if one * client belongs to DeviceButtonGrabClass make sure to * catch it. */ if (!have_device_button_grab_class_client) { rc = EVENT_DELIVERED; *client_return = client; *mask_return = mask; /* Success overrides non-success, so if we've been * successful on one client, return that */ if (mask & DeviceButtonGrabMask) have_device_button_grab_class_client = TRUE; } } else if (rc == EVENT_NOT_DELIVERED) rc = EVENT_REJECTED; } } return rc; }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,818
DeliverEventToWindowMask(DeviceIntPtr dev, WindowPtr win, xEvent *events, int count, Mask filter, GrabPtr grab, ClientPtr *client_return, Mask *mask_return) { InputClients *iclients; if (!GetClientsForDelivery(dev, win, events, filter, &iclients)) return EVENT_SKIP; return DeliverEventToInputClients(dev, iclients, win, events, count, filter, grab, client_return, mask_return); }
Exec Code Overflow
0
DeliverEventToWindowMask(DeviceIntPtr dev, WindowPtr win, xEvent *events, int count, Mask filter, GrabPtr grab, ClientPtr *client_return, Mask *mask_return) { InputClients *iclients; if (!GetClientsForDelivery(dev, win, events, filter, &iclients)) return EVENT_SKIP; return DeliverEventToInputClients(dev, iclients, win, events, count, filter, grab, client_return, mask_return); }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,819
DeliverEventsToWindow(DeviceIntPtr pDev, WindowPtr pWin, xEvent *pEvents, int count, Mask filter, GrabPtr grab) { int deliveries = 0, nondeliveries = 0; ClientPtr client = NullClient; Mask deliveryMask = 0; /* If a grab occurs due to a button press, then this mask is the mask of the grab. */ int type = pEvents->u.u.type; /* Deliver to window owner */ if ((filter == CantBeFiltered) || core_get_type(pEvents) != 0) { enum EventDeliveryState rc; rc = DeliverToWindowOwner(pDev, pWin, pEvents, count, filter, grab); switch (rc) { case EVENT_SKIP: return 0; case EVENT_REJECTED: nondeliveries--; break; case EVENT_DELIVERED: /* We delivered to the owner, with our event mask */ deliveries++; client = wClient(pWin); deliveryMask = pWin->eventMask; break; case EVENT_NOT_DELIVERED: break; } } /* CantBeFiltered means only window owner gets the event */ if (filter != CantBeFiltered) { enum EventDeliveryState rc; rc = DeliverEventToWindowMask(pDev, pWin, pEvents, count, filter, grab, &client, &deliveryMask); switch (rc) { case EVENT_SKIP: return 0; case EVENT_REJECTED: nondeliveries--; break; case EVENT_DELIVERED: deliveries++; break; case EVENT_NOT_DELIVERED: break; } } if (deliveries) { /* * Note that since core events are delivered first, an implicit grab may * be activated on a core grab, stopping the XI events. */ if (!grab && ActivateImplicitGrab(pDev, client, pWin, pEvents, deliveryMask)) /* grab activated */ ; else if (type == MotionNotify) pDev->valuator->motionHintWindow = pWin; else if (type == DeviceMotionNotify || type == DeviceButtonPress) CheckDeviceGrabAndHintWindow(pWin, type, (deviceKeyButtonPointer *) pEvents, grab, client, deliveryMask); return deliveries; } return nondeliveries; }
Exec Code Overflow
0
DeliverEventsToWindow(DeviceIntPtr pDev, WindowPtr pWin, xEvent *pEvents, int count, Mask filter, GrabPtr grab) { int deliveries = 0, nondeliveries = 0; ClientPtr client = NullClient; Mask deliveryMask = 0; /* If a grab occurs due to a button press, then this mask is the mask of the grab. */ int type = pEvents->u.u.type; /* Deliver to window owner */ if ((filter == CantBeFiltered) || core_get_type(pEvents) != 0) { enum EventDeliveryState rc; rc = DeliverToWindowOwner(pDev, pWin, pEvents, count, filter, grab); switch (rc) { case EVENT_SKIP: return 0; case EVENT_REJECTED: nondeliveries--; break; case EVENT_DELIVERED: /* We delivered to the owner, with our event mask */ deliveries++; client = wClient(pWin); deliveryMask = pWin->eventMask; break; case EVENT_NOT_DELIVERED: break; } } /* CantBeFiltered means only window owner gets the event */ if (filter != CantBeFiltered) { enum EventDeliveryState rc; rc = DeliverEventToWindowMask(pDev, pWin, pEvents, count, filter, grab, &client, &deliveryMask); switch (rc) { case EVENT_SKIP: return 0; case EVENT_REJECTED: nondeliveries--; break; case EVENT_DELIVERED: deliveries++; break; case EVENT_NOT_DELIVERED: break; } } if (deliveries) { /* * Note that since core events are delivered first, an implicit grab may * be activated on a core grab, stopping the XI events. */ if (!grab && ActivateImplicitGrab(pDev, client, pWin, pEvents, deliveryMask)) /* grab activated */ ; else if (type == MotionNotify) pDev->valuator->motionHintWindow = pWin; else if (type == DeviceMotionNotify || type == DeviceButtonPress) CheckDeviceGrabAndHintWindow(pWin, type, (deviceKeyButtonPointer *) pEvents, grab, client, deliveryMask); return deliveries; } return nondeliveries; }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,820
DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev, Bool deactivateGrab) { GrabPtr grab; GrabInfoPtr grabinfo; int deliveries = 0; DeviceIntPtr dev; SpritePtr pSprite = thisDev->spriteInfo->sprite; BOOL sendCore = FALSE; grabinfo = &thisDev->deviceGrab; grab = grabinfo->grab; if (grab->ownerEvents) { WindowPtr focus; /* Hack: Some pointer device have a focus class. So we need to check * for the type of event, to see if we really want to deliver it to * the focus window. For pointer events, the answer is no. */ if (IsPointerEvent(event)) focus = PointerRootWin; else if (thisDev->focus) { focus = thisDev->focus->win; if (focus == FollowKeyboardWin) focus = inputInfo.keyboard->focus->win; } else focus = PointerRootWin; if (focus == PointerRootWin) deliveries = DeliverDeviceEvents(pSprite->win, event, grab, NullWindow, thisDev); else if (focus && (focus == pSprite->win || IsParent(focus, pSprite->win))) deliveries = DeliverDeviceEvents(pSprite->win, event, grab, focus, thisDev); else if (focus) deliveries = DeliverDeviceEvents(focus, event, grab, focus, thisDev); } if (!deliveries) { sendCore = (IsMaster(thisDev) && thisDev->coreEvents); /* try core event */ if ((sendCore && grab->grabtype == CORE) || grab->grabtype != CORE) deliveries = DeliverOneGrabbedEvent(event, thisDev, grab->grabtype); if (deliveries && (event->any.type == ET_Motion)) thisDev->valuator->motionHintWindow = grab->window; } if (deliveries && !deactivateGrab && (event->any.type == ET_KeyPress || event->any.type == ET_KeyRelease || event->any.type == ET_ButtonPress || event->any.type == ET_ButtonRelease)) { switch (grabinfo->sync.state) { case FREEZE_BOTH_NEXT_EVENT: dev = GetPairedDevice(thisDev); if (dev) { FreezeThaw(dev, TRUE); if ((dev->deviceGrab.sync.state == FREEZE_BOTH_NEXT_EVENT) && (CLIENT_BITS(grab->resource) == CLIENT_BITS(dev->deviceGrab.grab->resource))) dev->deviceGrab.sync.state = FROZEN_NO_EVENT; else dev->deviceGrab.sync.other = grab; } /* fall through */ case FREEZE_NEXT_EVENT: grabinfo->sync.state = FROZEN_WITH_EVENT; FreezeThaw(thisDev, TRUE); *grabinfo->sync.event = event->device_event; break; } } return deliveries; }
Exec Code Overflow
0
DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev, Bool deactivateGrab) { GrabPtr grab; GrabInfoPtr grabinfo; int deliveries = 0; DeviceIntPtr dev; SpritePtr pSprite = thisDev->spriteInfo->sprite; BOOL sendCore = FALSE; grabinfo = &thisDev->deviceGrab; grab = grabinfo->grab; if (grab->ownerEvents) { WindowPtr focus; /* Hack: Some pointer device have a focus class. So we need to check * for the type of event, to see if we really want to deliver it to * the focus window. For pointer events, the answer is no. */ if (IsPointerEvent(event)) focus = PointerRootWin; else if (thisDev->focus) { focus = thisDev->focus->win; if (focus == FollowKeyboardWin) focus = inputInfo.keyboard->focus->win; } else focus = PointerRootWin; if (focus == PointerRootWin) deliveries = DeliverDeviceEvents(pSprite->win, event, grab, NullWindow, thisDev); else if (focus && (focus == pSprite->win || IsParent(focus, pSprite->win))) deliveries = DeliverDeviceEvents(pSprite->win, event, grab, focus, thisDev); else if (focus) deliveries = DeliverDeviceEvents(focus, event, grab, focus, thisDev); } if (!deliveries) { sendCore = (IsMaster(thisDev) && thisDev->coreEvents); /* try core event */ if ((sendCore && grab->grabtype == CORE) || grab->grabtype != CORE) deliveries = DeliverOneGrabbedEvent(event, thisDev, grab->grabtype); if (deliveries && (event->any.type == ET_Motion)) thisDev->valuator->motionHintWindow = grab->window; } if (deliveries && !deactivateGrab && (event->any.type == ET_KeyPress || event->any.type == ET_KeyRelease || event->any.type == ET_ButtonPress || event->any.type == ET_ButtonRelease)) { switch (grabinfo->sync.state) { case FREEZE_BOTH_NEXT_EVENT: dev = GetPairedDevice(thisDev); if (dev) { FreezeThaw(dev, TRUE); if ((dev->deviceGrab.sync.state == FREEZE_BOTH_NEXT_EVENT) && (CLIENT_BITS(grab->resource) == CLIENT_BITS(dev->deviceGrab.grab->resource))) dev->deviceGrab.sync.state = FROZEN_NO_EVENT; else dev->deviceGrab.sync.other = grab; } /* fall through */ case FREEZE_NEXT_EVENT: grabinfo->sync.state = FROZEN_WITH_EVENT; FreezeThaw(thisDev, TRUE); *grabinfo->sync.event = event->device_event; break; } } return deliveries; }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,821
DeliverOneEvent(InternalEvent *event, DeviceIntPtr dev, enum InputLevel level, WindowPtr win, Window child, GrabPtr grab) { xEvent *xE = NULL; int count = 0; int deliveries = 0; int rc; switch (level) { case XI2: rc = EventToXI2(event, &xE); count = 1; break; case XI: rc = EventToXI(event, &xE, &count); break; case CORE: rc = EventToCore(event, &xE, &count); break; default: rc = BadImplementation; break; } if (rc == Success) { deliveries = DeliverEvent(dev, xE, count, win, child, grab); free(xE); } else BUG_WARN_MSG(rc != BadMatch, "%s: conversion to level %d failed with rc %d\n", dev->name, level, rc); return deliveries; }
Exec Code Overflow
0
DeliverOneEvent(InternalEvent *event, DeviceIntPtr dev, enum InputLevel level, WindowPtr win, Window child, GrabPtr grab) { xEvent *xE = NULL; int count = 0; int deliveries = 0; int rc; switch (level) { case XI2: rc = EventToXI2(event, &xE); count = 1; break; case XI: rc = EventToXI(event, &xE, &count); break; case CORE: rc = EventToCore(event, &xE, &count); break; default: rc = BadImplementation; break; } if (rc == Success) { deliveries = DeliverEvent(dev, xE, count, win, child, grab); free(xE); } else BUG_WARN_MSG(rc != BadMatch, "%s: conversion to level %d failed with rc %d\n", dev->name, level, rc); return deliveries; }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,822
DeliverOneGrabbedEvent(InternalEvent *event, DeviceIntPtr dev, enum InputLevel level) { SpritePtr pSprite = dev->spriteInfo->sprite; int rc; xEvent *xE = NULL; int count = 0; int deliveries = 0; Mask mask; GrabInfoPtr grabinfo = &dev->deviceGrab; GrabPtr grab = grabinfo->grab; Mask filter; if (grab->grabtype != level) return 0; switch (level) { case XI2: rc = EventToXI2(event, &xE); count = 1; if (rc == Success) { int evtype = xi2_get_type(xE); mask = GetXI2MaskByte(grab->xi2mask, dev, evtype); filter = GetEventFilter(dev, xE); } break; case XI: if (grabinfo->fromPassiveGrab && grabinfo->implicitGrab) mask = grab->deviceMask; else mask = grab->eventMask; rc = EventToXI(event, &xE, &count); if (rc == Success) filter = GetEventFilter(dev, xE); break; case CORE: rc = EventToCore(event, &xE, &count); mask = grab->eventMask; if (rc == Success) filter = GetEventFilter(dev, xE); break; default: BUG_WARN_MSG(1, "Invalid input level %d\n", level); return 0; } if (rc == Success) { FixUpEventFromWindow(pSprite, xE, grab->window, None, TRUE); if (XaceHook(XACE_SEND_ACCESS, 0, dev, grab->window, xE, count) || XaceHook(XACE_RECEIVE_ACCESS, rClient(grab), grab->window, xE, count)) deliveries = 1; /* don't send, but pretend we did */ else if (level != CORE || !IsInterferingGrab(rClient(grab), dev, xE)) { deliveries = TryClientEvents(rClient(grab), dev, xE, count, mask, filter, grab); } } else BUG_WARN_MSG(rc != BadMatch, "%s: conversion to mode %d failed on %d with %d\n", dev->name, level, event->any.type, rc); free(xE); return deliveries; }
Exec Code Overflow
0
DeliverOneGrabbedEvent(InternalEvent *event, DeviceIntPtr dev, enum InputLevel level) { SpritePtr pSprite = dev->spriteInfo->sprite; int rc; xEvent *xE = NULL; int count = 0; int deliveries = 0; Mask mask; GrabInfoPtr grabinfo = &dev->deviceGrab; GrabPtr grab = grabinfo->grab; Mask filter; if (grab->grabtype != level) return 0; switch (level) { case XI2: rc = EventToXI2(event, &xE); count = 1; if (rc == Success) { int evtype = xi2_get_type(xE); mask = GetXI2MaskByte(grab->xi2mask, dev, evtype); filter = GetEventFilter(dev, xE); } break; case XI: if (grabinfo->fromPassiveGrab && grabinfo->implicitGrab) mask = grab->deviceMask; else mask = grab->eventMask; rc = EventToXI(event, &xE, &count); if (rc == Success) filter = GetEventFilter(dev, xE); break; case CORE: rc = EventToCore(event, &xE, &count); mask = grab->eventMask; if (rc == Success) filter = GetEventFilter(dev, xE); break; default: BUG_WARN_MSG(1, "Invalid input level %d\n", level); return 0; } if (rc == Success) { FixUpEventFromWindow(pSprite, xE, grab->window, None, TRUE); if (XaceHook(XACE_SEND_ACCESS, 0, dev, grab->window, xE, count) || XaceHook(XACE_RECEIVE_ACCESS, rClient(grab), grab->window, xE, count)) deliveries = 1; /* don't send, but pretend we did */ else if (level != CORE || !IsInterferingGrab(rClient(grab), dev, xE)) { deliveries = TryClientEvents(rClient(grab), dev, xE, count, mask, filter, grab); } } else BUG_WARN_MSG(rc != BadMatch, "%s: conversion to mode %d failed on %d with %d\n", dev->name, level, event->any.type, rc); free(xE); return deliveries; }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,823
DeliverRawEvent(RawDeviceEvent *ev, DeviceIntPtr device) { GrabPtr grab = device->deviceGrab.grab; xEvent *xi; int i, rc; int filter; rc = EventToXI2((InternalEvent *) ev, (xEvent **) &xi); if (rc != Success) { ErrorF("[Xi] %s: XI2 conversion failed in %s (%d)\n", __func__, device->name, rc); return; } if (grab) DeliverGrabbedEvent((InternalEvent *) ev, device, FALSE); filter = GetEventFilter(device, xi); for (i = 0; i < screenInfo.numScreens; i++) { WindowPtr root; InputClients *inputclients; root = screenInfo.screens[i]->root; if (!GetClientsForDelivery(device, root, xi, filter, &inputclients)) continue; for (; inputclients; inputclients = inputclients->next) { ClientPtr c; /* unused */ Mask m; /* unused */ InputClients ic = *inputclients; /* Because we run through the list manually, copy the actual * list, shorten the copy to only have one client and then pass * that down to DeliverEventToInputClients. This way we avoid * double events on XI 2.1 clients that have a grab on the * device. */ ic.next = NULL; if (!FilterRawEvents(rClient(&ic), grab, root)) DeliverEventToInputClients(device, &ic, root, xi, 1, filter, NULL, &c, &m); } } free(xi); }
Exec Code Overflow
0
DeliverRawEvent(RawDeviceEvent *ev, DeviceIntPtr device) { GrabPtr grab = device->deviceGrab.grab; xEvent *xi; int i, rc; int filter; rc = EventToXI2((InternalEvent *) ev, (xEvent **) &xi); if (rc != Success) { ErrorF("[Xi] %s: XI2 conversion failed in %s (%d)\n", __func__, device->name, rc); return; } if (grab) DeliverGrabbedEvent((InternalEvent *) ev, device, FALSE); filter = GetEventFilter(device, xi); for (i = 0; i < screenInfo.numScreens; i++) { WindowPtr root; InputClients *inputclients; root = screenInfo.screens[i]->root; if (!GetClientsForDelivery(device, root, xi, filter, &inputclients)) continue; for (; inputclients; inputclients = inputclients->next) { ClientPtr c; /* unused */ Mask m; /* unused */ InputClients ic = *inputclients; /* Because we run through the list manually, copy the actual * list, shorten the copy to only have one client and then pass * that down to DeliverEventToInputClients. This way we avoid * double events on XI 2.1 clients that have a grab on the * device. */ ic.next = NULL; if (!FilterRawEvents(rClient(&ic), grab, root)) DeliverEventToInputClients(device, &ic, root, xi, 1, filter, NULL, &c, &m); } } free(xi); }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,824
DetachFromMaster(DeviceIntPtr dev) { if (IsFloating(dev)) return; dev->saved_master_id = GetMaster(dev, MASTER_ATTACHED)->id; AttachDevice(NULL, dev, NULL); }
Exec Code Overflow
0
DetachFromMaster(DeviceIntPtr dev) { if (IsFloating(dev)) return; dev->saved_master_id = GetMaster(dev, MASTER_ATTACHED)->id; AttachDevice(NULL, dev, NULL); }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,825
DevHasCursor(DeviceIntPtr pDev) { return pDev->spriteInfo->spriteOwner; }
Exec Code Overflow
0
DevHasCursor(DeviceIntPtr pDev) { return pDev->spriteInfo->spriteOwner; }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,826
DeviceEnterLeaveEvent(DeviceIntPtr mouse, int sourceid, int type, int mode, int detail, WindowPtr pWin, Window child) { GrabPtr grab = mouse->deviceGrab.grab; xXIEnterEvent *event; WindowPtr focus; int filter; int btlen, len, i; DeviceIntPtr kbd; if ((mode == XINotifyPassiveGrab && type == XI_Leave) || (mode == XINotifyPassiveUngrab && type == XI_Enter)) return; btlen = (mouse->button) ? bits_to_bytes(mouse->button->numButtons) : 0; btlen = bytes_to_int32(btlen); len = sizeof(xXIEnterEvent) + btlen * 4; event = calloc(1, len); event->type = GenericEvent; event->extension = IReqCode; event->evtype = type; event->length = (len - sizeof(xEvent)) / 4; event->buttons_len = btlen; event->detail = detail; event->time = currentTime.milliseconds; event->deviceid = mouse->id; event->sourceid = sourceid; event->mode = mode; event->root_x = double_to_fp1616(mouse->spriteInfo->sprite->hot.x); event->root_y = double_to_fp1616(mouse->spriteInfo->sprite->hot.y); for (i = 0; mouse && mouse->button && i < mouse->button->numButtons; i++) if (BitIsOn(mouse->button->down, i)) SetBit(&event[1], i); kbd = GetMaster(mouse, MASTER_KEYBOARD); if (kbd && kbd->key) { event->mods.base_mods = kbd->key->xkbInfo->state.base_mods; event->mods.latched_mods = kbd->key->xkbInfo->state.latched_mods; event->mods.locked_mods = kbd->key->xkbInfo->state.locked_mods; event->group.base_group = kbd->key->xkbInfo->state.base_group; event->group.latched_group = kbd->key->xkbInfo->state.latched_group; event->group.locked_group = kbd->key->xkbInfo->state.locked_group; } focus = (kbd) ? kbd->focus->win : None; if ((focus != NoneWin) && ((pWin == focus) || (focus == PointerRootWin) || IsParent(focus, pWin))) event->focus = TRUE; FixUpEventFromWindow(mouse->spriteInfo->sprite, (xEvent *) event, pWin, None, FALSE); filter = GetEventFilter(mouse, (xEvent *) event); if (grab && grab->grabtype == XI2) { Mask mask; mask = xi2mask_isset(grab->xi2mask, mouse, type); TryClientEvents(rClient(grab), mouse, (xEvent *) event, 1, mask, 1, grab); } else { if (!WindowXI2MaskIsset(mouse, pWin, (xEvent *) event)) goto out; DeliverEventsToWindow(mouse, pWin, (xEvent *) event, 1, filter, NullGrab); } out: free(event); }
Exec Code Overflow
0
DeviceEnterLeaveEvent(DeviceIntPtr mouse, int sourceid, int type, int mode, int detail, WindowPtr pWin, Window child) { GrabPtr grab = mouse->deviceGrab.grab; xXIEnterEvent *event; WindowPtr focus; int filter; int btlen, len, i; DeviceIntPtr kbd; if ((mode == XINotifyPassiveGrab && type == XI_Leave) || (mode == XINotifyPassiveUngrab && type == XI_Enter)) return; btlen = (mouse->button) ? bits_to_bytes(mouse->button->numButtons) : 0; btlen = bytes_to_int32(btlen); len = sizeof(xXIEnterEvent) + btlen * 4; event = calloc(1, len); event->type = GenericEvent; event->extension = IReqCode; event->evtype = type; event->length = (len - sizeof(xEvent)) / 4; event->buttons_len = btlen; event->detail = detail; event->time = currentTime.milliseconds; event->deviceid = mouse->id; event->sourceid = sourceid; event->mode = mode; event->root_x = double_to_fp1616(mouse->spriteInfo->sprite->hot.x); event->root_y = double_to_fp1616(mouse->spriteInfo->sprite->hot.y); for (i = 0; mouse && mouse->button && i < mouse->button->numButtons; i++) if (BitIsOn(mouse->button->down, i)) SetBit(&event[1], i); kbd = GetMaster(mouse, MASTER_KEYBOARD); if (kbd && kbd->key) { event->mods.base_mods = kbd->key->xkbInfo->state.base_mods; event->mods.latched_mods = kbd->key->xkbInfo->state.latched_mods; event->mods.locked_mods = kbd->key->xkbInfo->state.locked_mods; event->group.base_group = kbd->key->xkbInfo->state.base_group; event->group.latched_group = kbd->key->xkbInfo->state.latched_group; event->group.locked_group = kbd->key->xkbInfo->state.locked_group; } focus = (kbd) ? kbd->focus->win : None; if ((focus != NoneWin) && ((pWin == focus) || (focus == PointerRootWin) || IsParent(focus, pWin))) event->focus = TRUE; FixUpEventFromWindow(mouse->spriteInfo->sprite, (xEvent *) event, pWin, None, FALSE); filter = GetEventFilter(mouse, (xEvent *) event); if (grab && grab->grabtype == XI2) { Mask mask; mask = xi2mask_isset(grab->xi2mask, mouse, type); TryClientEvents(rClient(grab), mouse, (xEvent *) event, 1, mask, 1, grab); } else { if (!WindowXI2MaskIsset(mouse, pWin, (xEvent *) event)) goto out; DeliverEventsToWindow(mouse, pWin, (xEvent *) event, 1, filter, NullGrab); } out: free(event); }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,827
EnqueueEvent(InternalEvent *ev, DeviceIntPtr device) { QdEventPtr tail = NULL; QdEventPtr qe; SpritePtr pSprite = device->spriteInfo->sprite; int eventlen; DeviceEvent *event = &ev->device_event; if (!xorg_list_is_empty(&syncEvents.pending)) tail = xorg_list_last_entry(&syncEvents.pending, QdEventRec, next); NoticeTimeMillis(device, &ev->any.time); /* Fix for key repeating bug. */ if (device->key != NULL && device->key->xkbInfo != NULL && event->type == ET_KeyRelease) AccessXCancelRepeatKey(device->key->xkbInfo, event->detail.key); if (DeviceEventCallback) { DeviceEventInfoRec eventinfo; /* The RECORD spec says that the root window field of motion events * must be valid. At this point, it hasn't been filled in yet, so * we do it here. The long expression below is necessary to get * the current root window; the apparently reasonable alternative * GetCurrentRootWindow()->drawable.id doesn't give you the right * answer on the first motion event after a screen change because * the data that GetCurrentRootWindow relies on hasn't been * updated yet. */ if (ev->any.type == ET_Motion) ev->device_event.root = pSprite->hotPhys.pScreen->root->drawable.id; eventinfo.event = ev; eventinfo.device = device; CallCallbacks(&DeviceEventCallback, (void *) &eventinfo); } if (event->type == ET_Motion) { #ifdef PANORAMIX if (!noPanoramiXExtension) { event->root_x += pSprite->screen->x - screenInfo.screens[0]->x; event->root_y += pSprite->screen->y - screenInfo.screens[0]->y; } #endif pSprite->hotPhys.x = event->root_x; pSprite->hotPhys.y = event->root_y; /* do motion compression, but not if from different devices */ if (tail && (tail->event->any.type == ET_Motion) && (tail->device == device) && (tail->pScreen == pSprite->hotPhys.pScreen)) { DeviceEvent *tailev = &tail->event->device_event; tailev->root_x = pSprite->hotPhys.x; tailev->root_y = pSprite->hotPhys.y; tailev->time = event->time; tail->months = currentTime.months; return; } } eventlen = event->length; qe = malloc(sizeof(QdEventRec) + eventlen); if (!qe) return; xorg_list_init(&qe->next); qe->device = device; qe->pScreen = pSprite->hotPhys.pScreen; qe->months = currentTime.months; qe->event = (InternalEvent *) (qe + 1); memcpy(qe->event, event, eventlen); xorg_list_append(&qe->next, &syncEvents.pending); }
Exec Code Overflow
0
EnqueueEvent(InternalEvent *ev, DeviceIntPtr device) { QdEventPtr tail = NULL; QdEventPtr qe; SpritePtr pSprite = device->spriteInfo->sprite; int eventlen; DeviceEvent *event = &ev->device_event; if (!xorg_list_is_empty(&syncEvents.pending)) tail = xorg_list_last_entry(&syncEvents.pending, QdEventRec, next); NoticeTimeMillis(device, &ev->any.time); /* Fix for key repeating bug. */ if (device->key != NULL && device->key->xkbInfo != NULL && event->type == ET_KeyRelease) AccessXCancelRepeatKey(device->key->xkbInfo, event->detail.key); if (DeviceEventCallback) { DeviceEventInfoRec eventinfo; /* The RECORD spec says that the root window field of motion events * must be valid. At this point, it hasn't been filled in yet, so * we do it here. The long expression below is necessary to get * the current root window; the apparently reasonable alternative * GetCurrentRootWindow()->drawable.id doesn't give you the right * answer on the first motion event after a screen change because * the data that GetCurrentRootWindow relies on hasn't been * updated yet. */ if (ev->any.type == ET_Motion) ev->device_event.root = pSprite->hotPhys.pScreen->root->drawable.id; eventinfo.event = ev; eventinfo.device = device; CallCallbacks(&DeviceEventCallback, (void *) &eventinfo); } if (event->type == ET_Motion) { #ifdef PANORAMIX if (!noPanoramiXExtension) { event->root_x += pSprite->screen->x - screenInfo.screens[0]->x; event->root_y += pSprite->screen->y - screenInfo.screens[0]->y; } #endif pSprite->hotPhys.x = event->root_x; pSprite->hotPhys.y = event->root_y; /* do motion compression, but not if from different devices */ if (tail && (tail->event->any.type == ET_Motion) && (tail->device == device) && (tail->pScreen == pSprite->hotPhys.pScreen)) { DeviceEvent *tailev = &tail->event->device_event; tailev->root_x = pSprite->hotPhys.x; tailev->root_y = pSprite->hotPhys.y; tailev->time = event->time; tail->months = currentTime.months; return; } } eventlen = event->length; qe = malloc(sizeof(QdEventRec) + eventlen); if (!qe) return; xorg_list_init(&qe->next); qe->device = device; qe->pScreen = pSprite->hotPhys.pScreen; qe->months = currentTime.months; qe->event = (InternalEvent *) (qe + 1); memcpy(qe->event, event, eventlen); xorg_list_append(&qe->next, &syncEvents.pending); }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,828
EventMaskForClient(WindowPtr pWin, ClientPtr client) { OtherClientsPtr other; if (wClient(pWin) == client) return pWin->eventMask; for (other = wOtherClients(pWin); other; other = other->next) { if (SameClient(other, client)) return other->mask; } return 0; }
Exec Code Overflow
0
EventMaskForClient(WindowPtr pWin, ClientPtr client) { OtherClientsPtr other; if (wClient(pWin) == client) return pWin->eventMask; for (other = wOtherClients(pWin); other; other = other->next) { if (SameClient(other, client)) return other->mask; } return 0; }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,829
EventSelectForWindow(WindowPtr pWin, ClientPtr client, Mask mask) { Mask check; OtherClients *others; DeviceIntPtr dev; int rc; if (mask & ~AllEventMasks) { client->errorValue = mask; return BadValue; } check = (mask & ManagerMask); if (check) { rc = XaceHook(XACE_RESOURCE_ACCESS, client, pWin->drawable.id, RT_WINDOW, pWin, RT_NONE, NULL, DixManageAccess); if (rc != Success) return rc; } check = (mask & AtMostOneClient); if (check & (pWin->eventMask | wOtherEventMasks(pWin))) { /* It is illegal for two different clients to select on any of the events for AtMostOneClient. However, it is OK, for some client to continue selecting on one of those events. */ if ((wClient(pWin) != client) && (check & pWin->eventMask)) return BadAccess; for (others = wOtherClients(pWin); others; others = others->next) { if (!SameClient(others, client) && (check & others->mask)) return BadAccess; } } if (wClient(pWin) == client) { check = pWin->eventMask; pWin->eventMask = mask; } else { for (others = wOtherClients(pWin); others; others = others->next) { if (SameClient(others, client)) { check = others->mask; if (mask == 0) { FreeResource(others->resource, RT_NONE); return Success; } else others->mask = mask; goto maskSet; } } check = 0; if (!pWin->optional && !MakeWindowOptional(pWin)) return BadAlloc; others = malloc(sizeof(OtherClients)); if (!others) return BadAlloc; others->mask = mask; others->resource = FakeClientID(client->index); others->next = pWin->optional->otherClients; pWin->optional->otherClients = others; if (!AddResource(others->resource, RT_OTHERCLIENT, (void *) pWin)) return BadAlloc; } maskSet: if ((mask & PointerMotionHintMask) && !(check & PointerMotionHintMask)) { for (dev = inputInfo.devices; dev; dev = dev->next) { if (dev->valuator && dev->valuator->motionHintWindow == pWin) dev->valuator->motionHintWindow = NullWindow; } } RecalculateDeliverableEvents(pWin); return Success; }
Exec Code Overflow
0
EventSelectForWindow(WindowPtr pWin, ClientPtr client, Mask mask) { Mask check; OtherClients *others; DeviceIntPtr dev; int rc; if (mask & ~AllEventMasks) { client->errorValue = mask; return BadValue; } check = (mask & ManagerMask); if (check) { rc = XaceHook(XACE_RESOURCE_ACCESS, client, pWin->drawable.id, RT_WINDOW, pWin, RT_NONE, NULL, DixManageAccess); if (rc != Success) return rc; } check = (mask & AtMostOneClient); if (check & (pWin->eventMask | wOtherEventMasks(pWin))) { /* It is illegal for two different clients to select on any of the events for AtMostOneClient. However, it is OK, for some client to continue selecting on one of those events. */ if ((wClient(pWin) != client) && (check & pWin->eventMask)) return BadAccess; for (others = wOtherClients(pWin); others; others = others->next) { if (!SameClient(others, client) && (check & others->mask)) return BadAccess; } } if (wClient(pWin) == client) { check = pWin->eventMask; pWin->eventMask = mask; } else { for (others = wOtherClients(pWin); others; others = others->next) { if (SameClient(others, client)) { check = others->mask; if (mask == 0) { FreeResource(others->resource, RT_NONE); return Success; } else others->mask = mask; goto maskSet; } } check = 0; if (!pWin->optional && !MakeWindowOptional(pWin)) return BadAlloc; others = malloc(sizeof(OtherClients)); if (!others) return BadAlloc; others->mask = mask; others->resource = FakeClientID(client->index); others->next = pWin->optional->otherClients; pWin->optional->otherClients = others; if (!AddResource(others->resource, RT_OTHERCLIENT, (void *) pWin)) return BadAlloc; } maskSet: if ((mask & PointerMotionHintMask) && !(check & PointerMotionHintMask)) { for (dev = inputInfo.devices; dev; dev = dev->next) { if (dev->valuator && dev->valuator->motionHintWindow == pWin) dev->valuator->motionHintWindow = NullWindow; } } RecalculateDeliverableEvents(pWin); return Success; }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,830
EventSuppressForWindow(WindowPtr pWin, ClientPtr client, Mask mask, Bool *checkOptional) { int i, freed; if (mask & ~PropagateMask) { client->errorValue = mask; return BadValue; } if (pWin->dontPropagate) DontPropagateRefCnts[pWin->dontPropagate]--; if (!mask) i = 0; else { for (i = DNPMCOUNT, freed = 0; --i > 0;) { if (!DontPropagateRefCnts[i]) freed = i; else if (mask == DontPropagateMasks[i]) break; } if (!i && freed) { i = freed; DontPropagateMasks[i] = mask; } } if (i || !mask) { pWin->dontPropagate = i; if (i) DontPropagateRefCnts[i]++; if (pWin->optional) { pWin->optional->dontPropagateMask = mask; *checkOptional = TRUE; } } else { if (!pWin->optional && !MakeWindowOptional(pWin)) { if (pWin->dontPropagate) DontPropagateRefCnts[pWin->dontPropagate]++; return BadAlloc; } pWin->dontPropagate = 0; pWin->optional->dontPropagateMask = mask; } RecalculateDeliverableEvents(pWin); return Success; }
Exec Code Overflow
0
EventSuppressForWindow(WindowPtr pWin, ClientPtr client, Mask mask, Bool *checkOptional) { int i, freed; if (mask & ~PropagateMask) { client->errorValue = mask; return BadValue; } if (pWin->dontPropagate) DontPropagateRefCnts[pWin->dontPropagate]--; if (!mask) i = 0; else { for (i = DNPMCOUNT, freed = 0; --i > 0;) { if (!DontPropagateRefCnts[i]) freed = i; else if (mask == DontPropagateMasks[i]) break; } if (!i && freed) { i = freed; DontPropagateMasks[i] = mask; } } if (i || !mask) { pWin->dontPropagate = i; if (i) DontPropagateRefCnts[i]++; if (pWin->optional) { pWin->optional->dontPropagateMask = mask; *checkOptional = TRUE; } } else { if (!pWin->optional && !MakeWindowOptional(pWin)) { if (pWin->dontPropagate) DontPropagateRefCnts[pWin->dontPropagate]++; return BadAlloc; } pWin->dontPropagate = 0; pWin->optional->dontPropagateMask = mask; } RecalculateDeliverableEvents(pWin); return Success; }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,831
FilterRawEvents(const ClientPtr client, const GrabPtr grab, WindowPtr root) { XIClientPtr client_xi_version; int cmp; /* device not grabbed -> don't filter */ if (!grab) return FALSE; client_xi_version = dixLookupPrivate(&client->devPrivates, XIClientPrivateKey); cmp = version_compare(client_xi_version->major_version, client_xi_version->minor_version, 2, 0); /* XI 2.0: if device is grabbed, skip XI 2.1: if device is grabbed by us, skip, we've already delivered */ if (cmp == 0) return TRUE; return (grab->window != root) ? FALSE : SameClient(grab, client); }
Exec Code Overflow
0
FilterRawEvents(const ClientPtr client, const GrabPtr grab, WindowPtr root) { XIClientPtr client_xi_version; int cmp; /* device not grabbed -> don't filter */ if (!grab) return FALSE; client_xi_version = dixLookupPrivate(&client->devPrivates, XIClientPrivateKey); cmp = version_compare(client_xi_version->major_version, client_xi_version->minor_version, 2, 0); /* XI 2.0: if device is grabbed, skip XI 2.1: if device is grabbed by us, skip, we've already delivered */ if (cmp == 0) return TRUE; return (grab->window != root) ? FALSE : SameClient(grab, client); }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,832
FindChildForEvent(SpritePtr pSprite, WindowPtr event) { WindowPtr w = DeepestSpriteWin(pSprite); Window child = None; /* If the search ends up past the root should the child field be set to none or should the value in the argument be passed through. It probably doesn't matter since everyone calls this function with child == None anyway. */ while (w) { /* If the source window is same as event window, child should be none. Don't bother going all all the way back to the root. */ if (w == event) { child = None; break; } if (w->parent == event) { child = w->drawable.id; break; } w = w->parent; } return child; }
Exec Code Overflow
0
FindChildForEvent(SpritePtr pSprite, WindowPtr event) { WindowPtr w = DeepestSpriteWin(pSprite); Window child = None; /* If the search ends up past the root should the child field be set to none or should the value in the argument be passed through. It probably doesn't matter since everyone calls this function with child == None anyway. */ while (w) { /* If the source window is same as event window, child should be none. Don't bother going all all the way back to the root. */ if (w == event) { child = None; break; } if (w->parent == event) { child = w->drawable.id; break; } w = w->parent; } return child; }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,833
FixKeyState(DeviceEvent *event, DeviceIntPtr keybd) { int key = event->detail.key; if (event->type == ET_KeyPress) { DebugF("FixKeyState: Key %d %s\n", key, ((event->type == ET_KeyPress) ? "down" : "up")); } if (event->type == ET_KeyPress) set_key_down(keybd, key, KEY_PROCESSED); else if (event->type == ET_KeyRelease) set_key_up(keybd, key, KEY_PROCESSED); else FatalError("Impossible keyboard event"); }
Exec Code Overflow
0
FixKeyState(DeviceEvent *event, DeviceIntPtr keybd) { int key = event->detail.key; if (event->type == ET_KeyPress) { DebugF("FixKeyState: Key %d %s\n", key, ((event->type == ET_KeyPress) ? "down" : "up")); } if (event->type == ET_KeyPress) set_key_down(keybd, key, KEY_PROCESSED); else if (event->type == ET_KeyRelease) set_key_up(keybd, key, KEY_PROCESSED); else FatalError("Impossible keyboard event"); }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,834
FixUpEventFromWindow(SpritePtr pSprite, xEvent *xE, WindowPtr pWin, Window child, Bool calcChild) { int evtype; if (calcChild) child = FindChildForEvent(pSprite, pWin); if ((evtype = xi2_get_type(xE))) { xXIDeviceEvent *event = (xXIDeviceEvent *) xE; switch (evtype) { case XI_RawKeyPress: case XI_RawKeyRelease: case XI_RawButtonPress: case XI_RawButtonRelease: case XI_RawMotion: case XI_RawTouchBegin: case XI_RawTouchUpdate: case XI_RawTouchEnd: case XI_DeviceChanged: case XI_HierarchyChanged: case XI_PropertyEvent: case XI_BarrierHit: case XI_BarrierLeave: return; default: break; } event->root = RootWindow(pSprite)->drawable.id; event->event = pWin->drawable.id; if (evtype == XI_TouchOwnership) { event->child = child; return; } if (pSprite->hot.pScreen == pWin->drawable.pScreen) { event->event_x = event->root_x - double_to_fp1616(pWin->drawable.x); event->event_y = event->root_y - double_to_fp1616(pWin->drawable.y); event->child = child; } else { event->event_x = 0; event->event_y = 0; event->child = None; } if (event->evtype == XI_Enter || event->evtype == XI_Leave || event->evtype == XI_FocusIn || event->evtype == XI_FocusOut) ((xXIEnterEvent *) event)->same_screen = (pSprite->hot.pScreen == pWin->drawable.pScreen); } else { XE_KBPTR.root = RootWindow(pSprite)->drawable.id; XE_KBPTR.event = pWin->drawable.id; if (pSprite->hot.pScreen == pWin->drawable.pScreen) { XE_KBPTR.sameScreen = xTrue; XE_KBPTR.child = child; XE_KBPTR.eventX = XE_KBPTR.rootX - pWin->drawable.x; XE_KBPTR.eventY = XE_KBPTR.rootY - pWin->drawable.y; } else { XE_KBPTR.sameScreen = xFalse; XE_KBPTR.child = None; XE_KBPTR.eventX = 0; XE_KBPTR.eventY = 0; } } }
Exec Code Overflow
0
FixUpEventFromWindow(SpritePtr pSprite, xEvent *xE, WindowPtr pWin, Window child, Bool calcChild) { int evtype; if (calcChild) child = FindChildForEvent(pSprite, pWin); if ((evtype = xi2_get_type(xE))) { xXIDeviceEvent *event = (xXIDeviceEvent *) xE; switch (evtype) { case XI_RawKeyPress: case XI_RawKeyRelease: case XI_RawButtonPress: case XI_RawButtonRelease: case XI_RawMotion: case XI_RawTouchBegin: case XI_RawTouchUpdate: case XI_RawTouchEnd: case XI_DeviceChanged: case XI_HierarchyChanged: case XI_PropertyEvent: case XI_BarrierHit: case XI_BarrierLeave: return; default: break; } event->root = RootWindow(pSprite)->drawable.id; event->event = pWin->drawable.id; if (evtype == XI_TouchOwnership) { event->child = child; return; } if (pSprite->hot.pScreen == pWin->drawable.pScreen) { event->event_x = event->root_x - double_to_fp1616(pWin->drawable.x); event->event_y = event->root_y - double_to_fp1616(pWin->drawable.y); event->child = child; } else { event->event_x = 0; event->event_y = 0; event->child = None; } if (event->evtype == XI_Enter || event->evtype == XI_Leave || event->evtype == XI_FocusIn || event->evtype == XI_FocusOut) ((xXIEnterEvent *) event)->same_screen = (pSprite->hot.pScreen == pWin->drawable.pScreen); } else { XE_KBPTR.root = RootWindow(pSprite)->drawable.id; XE_KBPTR.event = pWin->drawable.id; if (pSprite->hot.pScreen == pWin->drawable.pScreen) { XE_KBPTR.sameScreen = xTrue; XE_KBPTR.child = child; XE_KBPTR.eventX = XE_KBPTR.rootX - pWin->drawable.x; XE_KBPTR.eventY = XE_KBPTR.rootY - pWin->drawable.y; } else { XE_KBPTR.sameScreen = xFalse; XE_KBPTR.child = None; XE_KBPTR.eventX = 0; XE_KBPTR.eventY = 0; } } }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,835
void FreeSprite(DeviceIntPtr dev) { if (DevHasCursor(dev) && dev->spriteInfo->sprite) { if (dev->spriteInfo->sprite->current) FreeCursor(dev->spriteInfo->sprite->current, None); free(dev->spriteInfo->sprite->spriteTrace); free(dev->spriteInfo->sprite); } dev->spriteInfo->sprite = NULL; }
Exec Code Overflow
0
void FreeSprite(DeviceIntPtr dev) { if (DevHasCursor(dev) && dev->spriteInfo->sprite) { if (dev->spriteInfo->sprite->current) FreeCursor(dev->spriteInfo->sprite->current, None); free(dev->spriteInfo->sprite->spriteTrace); free(dev->spriteInfo->sprite); } dev->spriteInfo->sprite = NULL; }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,836
GetClientsForDelivery(DeviceIntPtr dev, WindowPtr win, xEvent *events, Mask filter, InputClients ** iclients) { int rc = 0; if (core_get_type(events) != 0) *iclients = (InputClients *) wOtherClients(win); else if (xi2_get_type(events) != 0) { OtherInputMasks *inputMasks = wOtherInputMasks(win); /* Has any client selected for the event? */ if (!WindowXI2MaskIsset(dev, win, events)) goto out; *iclients = inputMasks->inputClients; } else { OtherInputMasks *inputMasks = wOtherInputMasks(win); /* Has any client selected for the event? */ if (!inputMasks || !(inputMasks->inputEvents[dev->id] & filter)) goto out; *iclients = inputMasks->inputClients; } rc = 1; out: return rc; }
Exec Code Overflow
0
GetClientsForDelivery(DeviceIntPtr dev, WindowPtr win, xEvent *events, Mask filter, InputClients ** iclients) { int rc = 0; if (core_get_type(events) != 0) *iclients = (InputClients *) wOtherClients(win); else if (xi2_get_type(events) != 0) { OtherInputMasks *inputMasks = wOtherInputMasks(win); /* Has any client selected for the event? */ if (!WindowXI2MaskIsset(dev, win, events)) goto out; *iclients = inputMasks->inputClients; } else { OtherInputMasks *inputMasks = wOtherInputMasks(win); /* Has any client selected for the event? */ if (!inputMasks || !(inputMasks->inputEvents[dev->id] & filter)) goto out; *iclients = inputMasks->inputClients; } rc = 1; out: return rc; }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,837
GetEventMask(DeviceIntPtr dev, xEvent *event, InputClients * other) { int evtype; /* XI2 filters are only ever 8 bit, so let's return a 8 bit mask */ if ((evtype = xi2_get_type(event))) { return GetXI2MaskByte(other->xi2mask, dev, evtype); } else if (core_get_type(event) != 0) return other->mask[XIAllDevices]; else return other->mask[dev->id]; }
Exec Code Overflow
0
GetEventMask(DeviceIntPtr dev, xEvent *event, InputClients * other) { int evtype; /* XI2 filters are only ever 8 bit, so let's return a 8 bit mask */ if ((evtype = xi2_get_type(event))) { return GetXI2MaskByte(other->xi2mask, dev, evtype); } else if (core_get_type(event) != 0) return other->mask[XIAllDevices]; else return other->mask[dev->id]; }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,838
GetSpriteWindow(DeviceIntPtr pDev) { return pDev->spriteInfo->sprite->win; }
Exec Code Overflow
0
GetSpriteWindow(DeviceIntPtr pDev) { return pDev->spriteInfo->sprite->win; }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,839
GetXI2MaskByte(XI2Mask *mask, DeviceIntPtr dev, int event_type) { /* we just return the matching filter because that's the only use * for this mask anyway. */ if (xi2mask_isset(mask, dev, event_type)) return event_get_filter_from_xi2type(event_type); else return 0; }
Exec Code Overflow
0
GetXI2MaskByte(XI2Mask *mask, DeviceIntPtr dev, int event_type) { /* we just return the matching filter because that's the only use * for this mask anyway. */ if (xi2mask_isset(mask, dev, event_type)) return event_get_filter_from_xi2type(event_type); else return 0; }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,840
GrabDevice(ClientPtr client, DeviceIntPtr dev, unsigned pointer_mode, unsigned keyboard_mode, Window grabWindow, unsigned ownerEvents, Time ctime, GrabMask *mask, int grabtype, Cursor curs, Window confineToWin, CARD8 *status) { WindowPtr pWin, confineTo; GrabPtr grab; TimeStamp time; Mask access_mode = DixGrabAccess; int rc; GrabInfoPtr grabInfo = &dev->deviceGrab; CursorPtr cursor; UpdateCurrentTime(); if ((keyboard_mode != GrabModeSync) && (keyboard_mode != GrabModeAsync)) { client->errorValue = keyboard_mode; return BadValue; } if ((pointer_mode != GrabModeSync) && (pointer_mode != GrabModeAsync)) { client->errorValue = pointer_mode; return BadValue; } if ((ownerEvents != xFalse) && (ownerEvents != xTrue)) { client->errorValue = ownerEvents; return BadValue; } rc = dixLookupWindow(&pWin, grabWindow, client, DixSetAttrAccess); if (rc != Success) return rc; if (confineToWin == None) confineTo = NullWindow; else { rc = dixLookupWindow(&confineTo, confineToWin, client, DixSetAttrAccess); if (rc != Success) return rc; } if (curs == None) cursor = NullCursor; else { rc = dixLookupResourceByType((void **) &cursor, curs, RT_CURSOR, client, DixUseAccess); if (rc != Success) { client->errorValue = curs; return rc; } access_mode |= DixForceAccess; } if (keyboard_mode == GrabModeSync || pointer_mode == GrabModeSync) access_mode |= DixFreezeAccess; rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, access_mode); if (rc != Success) return rc; time = ClientTimeToServerTime(ctime); grab = grabInfo->grab; if (grab && grab->grabtype != grabtype) *status = AlreadyGrabbed; else if (grab && !SameClient(grab, client)) *status = AlreadyGrabbed; else if ((!pWin->realized) || (confineTo && !(confineTo->realized && BorderSizeNotEmpty(dev, confineTo)))) *status = GrabNotViewable; else if ((CompareTimeStamps(time, currentTime) == LATER) || (CompareTimeStamps(time, grabInfo->grabTime) == EARLIER)) *status = GrabInvalidTime; else if (grabInfo->sync.frozen && grabInfo->sync.other && !SameClient(grabInfo->sync.other, client)) *status = GrabFrozen; else { GrabPtr tempGrab; tempGrab = AllocGrab(NULL); if (tempGrab == NULL) return BadAlloc; tempGrab->next = NULL; tempGrab->window = pWin; tempGrab->resource = client->clientAsMask; tempGrab->ownerEvents = ownerEvents; tempGrab->keyboardMode = keyboard_mode; tempGrab->pointerMode = pointer_mode; if (grabtype == CORE) tempGrab->eventMask = mask->core; else if (grabtype == XI) tempGrab->eventMask = mask->xi; else xi2mask_merge(tempGrab->xi2mask, mask->xi2mask); tempGrab->device = dev; tempGrab->cursor = RefCursor(cursor); tempGrab->confineTo = confineTo; tempGrab->grabtype = grabtype; (*grabInfo->ActivateGrab) (dev, tempGrab, time, FALSE); *status = GrabSuccess; FreeGrab(tempGrab); } return Success; }
Exec Code Overflow
0
GrabDevice(ClientPtr client, DeviceIntPtr dev, unsigned pointer_mode, unsigned keyboard_mode, Window grabWindow, unsigned ownerEvents, Time ctime, GrabMask *mask, int grabtype, Cursor curs, Window confineToWin, CARD8 *status) { WindowPtr pWin, confineTo; GrabPtr grab; TimeStamp time; Mask access_mode = DixGrabAccess; int rc; GrabInfoPtr grabInfo = &dev->deviceGrab; CursorPtr cursor; UpdateCurrentTime(); if ((keyboard_mode != GrabModeSync) && (keyboard_mode != GrabModeAsync)) { client->errorValue = keyboard_mode; return BadValue; } if ((pointer_mode != GrabModeSync) && (pointer_mode != GrabModeAsync)) { client->errorValue = pointer_mode; return BadValue; } if ((ownerEvents != xFalse) && (ownerEvents != xTrue)) { client->errorValue = ownerEvents; return BadValue; } rc = dixLookupWindow(&pWin, grabWindow, client, DixSetAttrAccess); if (rc != Success) return rc; if (confineToWin == None) confineTo = NullWindow; else { rc = dixLookupWindow(&confineTo, confineToWin, client, DixSetAttrAccess); if (rc != Success) return rc; } if (curs == None) cursor = NullCursor; else { rc = dixLookupResourceByType((void **) &cursor, curs, RT_CURSOR, client, DixUseAccess); if (rc != Success) { client->errorValue = curs; return rc; } access_mode |= DixForceAccess; } if (keyboard_mode == GrabModeSync || pointer_mode == GrabModeSync) access_mode |= DixFreezeAccess; rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, access_mode); if (rc != Success) return rc; time = ClientTimeToServerTime(ctime); grab = grabInfo->grab; if (grab && grab->grabtype != grabtype) *status = AlreadyGrabbed; else if (grab && !SameClient(grab, client)) *status = AlreadyGrabbed; else if ((!pWin->realized) || (confineTo && !(confineTo->realized && BorderSizeNotEmpty(dev, confineTo)))) *status = GrabNotViewable; else if ((CompareTimeStamps(time, currentTime) == LATER) || (CompareTimeStamps(time, grabInfo->grabTime) == EARLIER)) *status = GrabInvalidTime; else if (grabInfo->sync.frozen && grabInfo->sync.other && !SameClient(grabInfo->sync.other, client)) *status = GrabFrozen; else { GrabPtr tempGrab; tempGrab = AllocGrab(NULL); if (tempGrab == NULL) return BadAlloc; tempGrab->next = NULL; tempGrab->window = pWin; tempGrab->resource = client->clientAsMask; tempGrab->ownerEvents = ownerEvents; tempGrab->keyboardMode = keyboard_mode; tempGrab->pointerMode = pointer_mode; if (grabtype == CORE) tempGrab->eventMask = mask->core; else if (grabtype == XI) tempGrab->eventMask = mask->xi; else xi2mask_merge(tempGrab->xi2mask, mask->xi2mask); tempGrab->device = dev; tempGrab->cursor = RefCursor(cursor); tempGrab->confineTo = confineTo; tempGrab->grabtype = grabtype; (*grabInfo->ActivateGrab) (dev, tempGrab, time, FALSE); *status = GrabSuccess; FreeGrab(tempGrab); } return Success; }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,841
InitEvents(void) { int i; QdEventPtr qe, tmp; inputInfo.numDevices = 0; inputInfo.devices = (DeviceIntPtr) NULL; inputInfo.off_devices = (DeviceIntPtr) NULL; inputInfo.keyboard = (DeviceIntPtr) NULL; inputInfo.pointer = (DeviceIntPtr) NULL; for (i = 0; i < MAXDEVICES; i++) { DeviceIntRec dummy; memcpy(&event_filters[i], default_filter, sizeof(default_filter)); dummy.id = i; NoticeTime(&dummy, currentTime); LastEventTimeToggleResetFlag(i, FALSE); } syncEvents.replayDev = (DeviceIntPtr) NULL; syncEvents.replayWin = NullWindow; if (syncEvents.pending.next) xorg_list_for_each_entry_safe(qe, tmp, &syncEvents.pending, next) free(qe); xorg_list_init(&syncEvents.pending); syncEvents.playingEvents = FALSE; syncEvents.time.months = 0; syncEvents.time.milliseconds = 0; /* hardly matters */ currentTime.months = 0; currentTime.milliseconds = GetTimeInMillis(); for (i = 0; i < DNPMCOUNT; i++) { DontPropagateMasks[i] = 0; DontPropagateRefCnts[i] = 0; } InputEventList = InitEventList(GetMaximumEventsNum()); if (!InputEventList) FatalError("[dix] Failed to allocate input event list.\n"); }
Exec Code Overflow
0
InitEvents(void) { int i; QdEventPtr qe, tmp; inputInfo.numDevices = 0; inputInfo.devices = (DeviceIntPtr) NULL; inputInfo.off_devices = (DeviceIntPtr) NULL; inputInfo.keyboard = (DeviceIntPtr) NULL; inputInfo.pointer = (DeviceIntPtr) NULL; for (i = 0; i < MAXDEVICES; i++) { DeviceIntRec dummy; memcpy(&event_filters[i], default_filter, sizeof(default_filter)); dummy.id = i; NoticeTime(&dummy, currentTime); LastEventTimeToggleResetFlag(i, FALSE); } syncEvents.replayDev = (DeviceIntPtr) NULL; syncEvents.replayWin = NullWindow; if (syncEvents.pending.next) xorg_list_for_each_entry_safe(qe, tmp, &syncEvents.pending, next) free(qe); xorg_list_init(&syncEvents.pending); syncEvents.playingEvents = FALSE; syncEvents.time.months = 0; syncEvents.time.milliseconds = 0; /* hardly matters */ currentTime.months = 0; currentTime.milliseconds = GetTimeInMillis(); for (i = 0; i < DNPMCOUNT; i++) { DontPropagateMasks[i] = 0; DontPropagateRefCnts[i] = 0; } InputEventList = InitEventList(GetMaximumEventsNum()); if (!InputEventList) FatalError("[dix] Failed to allocate input event list.\n"); }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,842
InitializeSprite(DeviceIntPtr pDev, WindowPtr pWin) { SpritePtr pSprite; ScreenPtr pScreen; CursorPtr pCursor; if (!pDev->spriteInfo->sprite) { DeviceIntPtr it; pDev->spriteInfo->sprite = (SpritePtr) calloc(1, sizeof(SpriteRec)); if (!pDev->spriteInfo->sprite) FatalError("InitializeSprite: failed to allocate sprite struct"); /* We may have paired another device with this device before our * device had a actual sprite. We need to check for this and reset the * sprite field for all paired devices. * * The VCK is always paired with the VCP before the VCP has a sprite. */ for (it = inputInfo.devices; it; it = it->next) { if (it->spriteInfo->paired == pDev) it->spriteInfo->sprite = pDev->spriteInfo->sprite; } if (inputInfo.keyboard->spriteInfo->paired == pDev) inputInfo.keyboard->spriteInfo->sprite = pDev->spriteInfo->sprite; } pSprite = pDev->spriteInfo->sprite; pDev->spriteInfo->spriteOwner = TRUE; pScreen = (pWin) ? pWin->drawable.pScreen : (ScreenPtr) NULL; pSprite->hot.pScreen = pScreen; pSprite->hotPhys.pScreen = pScreen; if (pScreen) { pSprite->hotPhys.x = pScreen->width / 2; pSprite->hotPhys.y = pScreen->height / 2; pSprite->hotLimits.x2 = pScreen->width; pSprite->hotLimits.y2 = pScreen->height; } pSprite->hot = pSprite->hotPhys; pSprite->win = pWin; if (pWin) { pCursor = wCursor(pWin); pSprite->spriteTrace = (WindowPtr *) calloc(1, 32 * sizeof(WindowPtr)); if (!pSprite->spriteTrace) FatalError("Failed to allocate spriteTrace"); pSprite->spriteTraceSize = 32; RootWindow(pDev->spriteInfo->sprite) = pWin; pSprite->spriteTraceGood = 1; pSprite->pEnqueueScreen = pScreen; pSprite->pDequeueScreen = pSprite->pEnqueueScreen; } else { pCursor = NullCursor; pSprite->spriteTrace = NULL; pSprite->spriteTraceSize = 0; pSprite->spriteTraceGood = 0; pSprite->pEnqueueScreen = screenInfo.screens[0]; pSprite->pDequeueScreen = pSprite->pEnqueueScreen; } pCursor = RefCursor(pCursor); if (pSprite->current) FreeCursor(pSprite->current, None); pSprite->current = pCursor; if (pScreen) { (*pScreen->RealizeCursor) (pDev, pScreen, pSprite->current); (*pScreen->CursorLimits) (pDev, pScreen, pSprite->current, &pSprite->hotLimits, &pSprite->physLimits); pSprite->confined = FALSE; (*pScreen->ConstrainCursor) (pDev, pScreen, &pSprite->physLimits); (*pScreen->SetCursorPosition) (pDev, pScreen, pSprite->hot.x, pSprite->hot.y, FALSE); (*pScreen->DisplayCursor) (pDev, pScreen, pSprite->current); } #ifdef PANORAMIX if (!noPanoramiXExtension) { pSprite->hotLimits.x1 = -screenInfo.screens[0]->x; pSprite->hotLimits.y1 = -screenInfo.screens[0]->y; pSprite->hotLimits.x2 = PanoramiXPixWidth - screenInfo.screens[0]->x; pSprite->hotLimits.y2 = PanoramiXPixHeight - screenInfo.screens[0]->y; pSprite->physLimits = pSprite->hotLimits; pSprite->confineWin = NullWindow; pSprite->hotShape = NullRegion; pSprite->screen = pScreen; /* gotta UNINIT these someplace */ RegionNull(&pSprite->Reg1); RegionNull(&pSprite->Reg2); } #endif }
Exec Code Overflow
0
InitializeSprite(DeviceIntPtr pDev, WindowPtr pWin) { SpritePtr pSprite; ScreenPtr pScreen; CursorPtr pCursor; if (!pDev->spriteInfo->sprite) { DeviceIntPtr it; pDev->spriteInfo->sprite = (SpritePtr) calloc(1, sizeof(SpriteRec)); if (!pDev->spriteInfo->sprite) FatalError("InitializeSprite: failed to allocate sprite struct"); /* We may have paired another device with this device before our * device had a actual sprite. We need to check for this and reset the * sprite field for all paired devices. * * The VCK is always paired with the VCP before the VCP has a sprite. */ for (it = inputInfo.devices; it; it = it->next) { if (it->spriteInfo->paired == pDev) it->spriteInfo->sprite = pDev->spriteInfo->sprite; } if (inputInfo.keyboard->spriteInfo->paired == pDev) inputInfo.keyboard->spriteInfo->sprite = pDev->spriteInfo->sprite; } pSprite = pDev->spriteInfo->sprite; pDev->spriteInfo->spriteOwner = TRUE; pScreen = (pWin) ? pWin->drawable.pScreen : (ScreenPtr) NULL; pSprite->hot.pScreen = pScreen; pSprite->hotPhys.pScreen = pScreen; if (pScreen) { pSprite->hotPhys.x = pScreen->width / 2; pSprite->hotPhys.y = pScreen->height / 2; pSprite->hotLimits.x2 = pScreen->width; pSprite->hotLimits.y2 = pScreen->height; } pSprite->hot = pSprite->hotPhys; pSprite->win = pWin; if (pWin) { pCursor = wCursor(pWin); pSprite->spriteTrace = (WindowPtr *) calloc(1, 32 * sizeof(WindowPtr)); if (!pSprite->spriteTrace) FatalError("Failed to allocate spriteTrace"); pSprite->spriteTraceSize = 32; RootWindow(pDev->spriteInfo->sprite) = pWin; pSprite->spriteTraceGood = 1; pSprite->pEnqueueScreen = pScreen; pSprite->pDequeueScreen = pSprite->pEnqueueScreen; } else { pCursor = NullCursor; pSprite->spriteTrace = NULL; pSprite->spriteTraceSize = 0; pSprite->spriteTraceGood = 0; pSprite->pEnqueueScreen = screenInfo.screens[0]; pSprite->pDequeueScreen = pSprite->pEnqueueScreen; } pCursor = RefCursor(pCursor); if (pSprite->current) FreeCursor(pSprite->current, None); pSprite->current = pCursor; if (pScreen) { (*pScreen->RealizeCursor) (pDev, pScreen, pSprite->current); (*pScreen->CursorLimits) (pDev, pScreen, pSprite->current, &pSprite->hotLimits, &pSprite->physLimits); pSprite->confined = FALSE; (*pScreen->ConstrainCursor) (pDev, pScreen, &pSprite->physLimits); (*pScreen->SetCursorPosition) (pDev, pScreen, pSprite->hot.x, pSprite->hot.y, FALSE); (*pScreen->DisplayCursor) (pDev, pScreen, pSprite->current); } #ifdef PANORAMIX if (!noPanoramiXExtension) { pSprite->hotLimits.x1 = -screenInfo.screens[0]->x; pSprite->hotLimits.y1 = -screenInfo.screens[0]->y; pSprite->hotLimits.x2 = PanoramiXPixWidth - screenInfo.screens[0]->x; pSprite->hotLimits.y2 = PanoramiXPixHeight - screenInfo.screens[0]->y; pSprite->physLimits = pSprite->hotLimits; pSprite->confineWin = NullWindow; pSprite->hotShape = NullRegion; pSprite->screen = pScreen; /* gotta UNINIT these someplace */ RegionNull(&pSprite->Reg1); RegionNull(&pSprite->Reg2); } #endif }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,843
IsFloating(DeviceIntPtr dev) { return !IsMaster(dev) && GetMaster(dev, MASTER_KEYBOARD) == NULL; }
Exec Code Overflow
0
IsFloating(DeviceIntPtr dev) { return !IsMaster(dev) && GetMaster(dev, MASTER_KEYBOARD) == NULL; }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,844
IsInterferingGrab(ClientPtr client, DeviceIntPtr dev, xEvent *event) { DeviceIntPtr it = inputInfo.devices; switch (event->u.u.type) { case KeyPress: case KeyRelease: case ButtonPress: case ButtonRelease: case MotionNotify: case EnterNotify: case LeaveNotify: break; default: return FALSE; } if (dev->deviceGrab.grab && SameClient(dev->deviceGrab.grab, client)) return FALSE; while (it) { if (it != dev) { if (it->deviceGrab.grab && SameClient(it->deviceGrab.grab, client) && !it->deviceGrab.fromPassiveGrab) { if ((IsPointerDevice(it) && IsPointerDevice(dev)) || (IsKeyboardDevice(it) && IsKeyboardDevice(dev))) return TRUE; } } it = it->next; } return FALSE; }
Exec Code Overflow
0
IsInterferingGrab(ClientPtr client, DeviceIntPtr dev, xEvent *event) { DeviceIntPtr it = inputInfo.devices; switch (event->u.u.type) { case KeyPress: case KeyRelease: case ButtonPress: case ButtonRelease: case MotionNotify: case EnterNotify: case LeaveNotify: break; default: return FALSE; } if (dev->deviceGrab.grab && SameClient(dev->deviceGrab.grab, client)) return FALSE; while (it) { if (it != dev) { if (it->deviceGrab.grab && SameClient(it->deviceGrab.grab, client) && !it->deviceGrab.fromPassiveGrab) { if ((IsPointerDevice(it) && IsPointerDevice(dev)) || (IsKeyboardDevice(it) && IsKeyboardDevice(dev))) return TRUE; } } it = it->next; } return FALSE; }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,845
IsMaster(DeviceIntPtr dev) { return dev->type == MASTER_POINTER || dev->type == MASTER_KEYBOARD; }
Exec Code Overflow
0
IsMaster(DeviceIntPtr dev) { return dev->type == MASTER_POINTER || dev->type == MASTER_KEYBOARD; }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,846
IsParent(WindowPtr a, WindowPtr b) { for (b = b->parent; b; b = b->parent) if (b == a) return TRUE; return FALSE; }
Exec Code Overflow
0
IsParent(WindowPtr a, WindowPtr b) { for (b = b->parent; b; b = b->parent) if (b == a) return TRUE; return FALSE; }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,847
LastEventTime(int deviceid) { return lastDeviceEventTime[deviceid].time; }
Exec Code Overflow
0
LastEventTime(int deviceid) { return lastDeviceEventTime[deviceid].time; }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,848
LastEventTimeToggleResetAll(Bool state) { DeviceIntPtr dev; nt_list_for_each_entry(dev, inputInfo.devices, next) { LastEventTimeToggleResetFlag(dev->id, FALSE); } LastEventTimeToggleResetFlag(XIAllDevices, FALSE); LastEventTimeToggleResetFlag(XIAllMasterDevices, FALSE); }
Exec Code Overflow
0
LastEventTimeToggleResetAll(Bool state) { DeviceIntPtr dev; nt_list_for_each_entry(dev, inputInfo.devices, next) { LastEventTimeToggleResetFlag(dev->id, FALSE); } LastEventTimeToggleResetFlag(XIAllDevices, FALSE); LastEventTimeToggleResetFlag(XIAllMasterDevices, FALSE); }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,849
LastEventTimeToggleResetFlag(int deviceid, Bool state) { lastDeviceEventTime[deviceid].reset = state; }
Exec Code Overflow
0
LastEventTimeToggleResetFlag(int deviceid, Bool state) { lastDeviceEventTime[deviceid].reset = state; }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,850
LastEventTimeWasReset(int deviceid) { return lastDeviceEventTime[deviceid].reset; }
Exec Code Overflow
0
LastEventTimeWasReset(int deviceid) { return lastDeviceEventTime[deviceid].reset; }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,851
MaybeDeliverEventsToClient(WindowPtr pWin, xEvent *pEvents, int count, Mask filter, ClientPtr dontClient) { OtherClients *other; if (pWin->eventMask & filter) { if (wClient(pWin) == dontClient) return 0; #ifdef PANORAMIX if (!noPanoramiXExtension && pWin->drawable.pScreen->myNum) return XineramaTryClientEventsResult(wClient(pWin), NullGrab, pWin->eventMask, filter); #endif if (XaceHook(XACE_RECEIVE_ACCESS, wClient(pWin), pWin, pEvents, count)) return 1; /* don't send, but pretend we did */ return TryClientEvents(wClient(pWin), NULL, pEvents, count, pWin->eventMask, filter, NullGrab); } for (other = wOtherClients(pWin); other; other = other->next) { if (other->mask & filter) { if (SameClient(other, dontClient)) return 0; #ifdef PANORAMIX if (!noPanoramiXExtension && pWin->drawable.pScreen->myNum) return XineramaTryClientEventsResult(rClient(other), NullGrab, other->mask, filter); #endif if (XaceHook(XACE_RECEIVE_ACCESS, rClient(other), pWin, pEvents, count)) return 1; /* don't send, but pretend we did */ return TryClientEvents(rClient(other), NULL, pEvents, count, other->mask, filter, NullGrab); } } return 2; }
Exec Code Overflow
0
MaybeDeliverEventsToClient(WindowPtr pWin, xEvent *pEvents, int count, Mask filter, ClientPtr dontClient) { OtherClients *other; if (pWin->eventMask & filter) { if (wClient(pWin) == dontClient) return 0; #ifdef PANORAMIX if (!noPanoramiXExtension && pWin->drawable.pScreen->myNum) return XineramaTryClientEventsResult(wClient(pWin), NullGrab, pWin->eventMask, filter); #endif if (XaceHook(XACE_RECEIVE_ACCESS, wClient(pWin), pWin, pEvents, count)) return 1; /* don't send, but pretend we did */ return TryClientEvents(wClient(pWin), NULL, pEvents, count, pWin->eventMask, filter, NullGrab); } for (other = wOtherClients(pWin); other; other = other->next) { if (other->mask & filter) { if (SameClient(other, dontClient)) return 0; #ifdef PANORAMIX if (!noPanoramiXExtension && pWin->drawable.pScreen->myNum) return XineramaTryClientEventsResult(rClient(other), NullGrab, other->mask, filter); #endif if (XaceHook(XACE_RECEIVE_ACCESS, rClient(other), pWin, pEvents, count)) return 1; /* don't send, but pretend we did */ return TryClientEvents(rClient(other), NULL, pEvents, count, other->mask, filter, NullGrab); } } return 2; }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,852
NotImplemented(xEvent *from, xEvent *to) { FatalError("Not implemented"); }
Exec Code Overflow
0
NotImplemented(xEvent *from, xEvent *to) { FatalError("Not implemented"); }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,853
NoticeTimeMillis(const DeviceIntPtr dev, CARD32 *ms) { TimeStamp time; if (*ms < currentTime.milliseconds) MonthChangedOrBadTime(ms); time.months = currentTime.months; time.milliseconds = *ms; NoticeTime(dev, time); }
Exec Code Overflow
0
NoticeTimeMillis(const DeviceIntPtr dev, CARD32 *ms) { TimeStamp time; if (*ms < currentTime.milliseconds) MonthChangedOrBadTime(ms); time.months = currentTime.months; time.milliseconds = *ms; NoticeTime(dev, time); }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,854
OtherClientGone(void *value, XID id) { OtherClientsPtr other, prev; WindowPtr pWin = (WindowPtr) value; prev = 0; for (other = wOtherClients(pWin); other; other = other->next) { if (other->resource == id) { if (prev) prev->next = other->next; else { if (!(pWin->optional->otherClients = other->next)) CheckWindowOptionalNeed(pWin); } free(other); RecalculateDeliverableEvents(pWin); return Success; } prev = other; } FatalError("client not on event list"); }
Exec Code Overflow
0
OtherClientGone(void *value, XID id) { OtherClientsPtr other, prev; WindowPtr pWin = (WindowPtr) value; prev = 0; for (other = wOtherClients(pWin); other; other = other->next) { if (other->resource == id) { if (prev) prev->next = other->next; else { if (!(pWin->optional->otherClients = other->next)) CheckWindowOptionalNeed(pWin); } free(other); RecalculateDeliverableEvents(pWin); return Success; } prev = other; } FatalError("client not on event list"); }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,855
PickKeyboard(ClientPtr client) { DeviceIntPtr ptr = PickPointer(client); DeviceIntPtr kbd = GetMaster(ptr, MASTER_KEYBOARD); if (!kbd) { ErrorF("[dix] ClientPointer not paired with a keyboard. This " "is a bug.\n"); } return kbd; }
Exec Code Overflow
0
PickKeyboard(ClientPtr client) { DeviceIntPtr ptr = PickPointer(client); DeviceIntPtr kbd = GetMaster(ptr, MASTER_KEYBOARD); if (!kbd) { ErrorF("[dix] ClientPointer not paired with a keyboard. This " "is a bug.\n"); } return kbd; }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,856
PickPointer(ClientPtr client) { DeviceIntPtr it = inputInfo.devices; /* First, check if the client currently has a grab on a device. Even * keyboards count. */ for (it = inputInfo.devices; it; it = it->next) { GrabPtr grab = it->deviceGrab.grab; if (grab && grab->grabtype == CORE && SameClient(grab, client)) { it = GetMaster(it, MASTER_POINTER); return it; /* Always return a core grabbed device */ } } if (!client->clientPtr) { it = inputInfo.devices; while (it) { if (IsMaster(it) && it->spriteInfo->spriteOwner) { client->clientPtr = it; break; } it = it->next; } } return client->clientPtr; }
Exec Code Overflow
0
PickPointer(ClientPtr client) { DeviceIntPtr it = inputInfo.devices; /* First, check if the client currently has a grab on a device. Even * keyboards count. */ for (it = inputInfo.devices; it; it = it->next) { GrabPtr grab = it->deviceGrab.grab; if (grab && grab->grabtype == CORE && SameClient(grab, client)) { it = GetMaster(it, MASTER_POINTER); return it; /* Always return a core grabbed device */ } } if (!client->clientPtr) { it = inputInfo.devices; while (it) { if (IsMaster(it) && it->spriteInfo->spriteOwner) { client->clientPtr = it; break; } it = it->next; } } return client->clientPtr; }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,857
PlayReleasedEvents(void) { QdEventPtr tmp; QdEventPtr qe; DeviceIntPtr dev; DeviceIntPtr pDev; restart: xorg_list_for_each_entry_safe(qe, tmp, &syncEvents.pending, next) { if (!qe->device->deviceGrab.sync.frozen) { xorg_list_del(&qe->next); pDev = qe->device; if (qe->event->any.type == ET_Motion) CheckVirtualMotion(pDev, qe, NullWindow); syncEvents.time.months = qe->months; syncEvents.time.milliseconds = qe->event->any.time; #ifdef PANORAMIX /* Translate back to the sprite screen since processInputProc will translate from sprite screen to screen 0 upon reentry to the DIX layer */ if (!noPanoramiXExtension) { DeviceEvent *ev = &qe->event->device_event; switch (ev->type) { case ET_Motion: case ET_ButtonPress: case ET_ButtonRelease: case ET_KeyPress: case ET_KeyRelease: case ET_ProximityIn: case ET_ProximityOut: case ET_TouchBegin: case ET_TouchUpdate: case ET_TouchEnd: ev->root_x += screenInfo.screens[0]->x - pDev->spriteInfo->sprite->screen->x; ev->root_y += screenInfo.screens[0]->y - pDev->spriteInfo->sprite->screen->y; break; default: break; } } #endif (*qe->device->public.processInputProc) (qe->event, qe->device); free(qe); for (dev = inputInfo.devices; dev && dev->deviceGrab.sync.frozen; dev = dev->next); if (!dev) break; /* Playing the event may have unfrozen another device. */ /* So to play it safe, restart at the head of the queue */ goto restart; } } }
Exec Code Overflow
0
PlayReleasedEvents(void) { QdEventPtr tmp; QdEventPtr qe; DeviceIntPtr dev; DeviceIntPtr pDev; restart: xorg_list_for_each_entry_safe(qe, tmp, &syncEvents.pending, next) { if (!qe->device->deviceGrab.sync.frozen) { xorg_list_del(&qe->next); pDev = qe->device; if (qe->event->any.type == ET_Motion) CheckVirtualMotion(pDev, qe, NullWindow); syncEvents.time.months = qe->months; syncEvents.time.milliseconds = qe->event->any.time; #ifdef PANORAMIX /* Translate back to the sprite screen since processInputProc will translate from sprite screen to screen 0 upon reentry to the DIX layer */ if (!noPanoramiXExtension) { DeviceEvent *ev = &qe->event->device_event; switch (ev->type) { case ET_Motion: case ET_ButtonPress: case ET_ButtonRelease: case ET_KeyPress: case ET_KeyRelease: case ET_ProximityIn: case ET_ProximityOut: case ET_TouchBegin: case ET_TouchUpdate: case ET_TouchEnd: ev->root_x += screenInfo.screens[0]->x - pDev->spriteInfo->sprite->screen->x; ev->root_y += screenInfo.screens[0]->y - pDev->spriteInfo->sprite->screen->y; break; default: break; } } #endif (*qe->device->public.processInputProc) (qe->event, qe->device); free(qe); for (dev = inputInfo.devices; dev && dev->deviceGrab.sync.frozen; dev = dev->next); if (!dev) break; /* Playing the event may have unfrozen another device. */ /* So to play it safe, restart at the head of the queue */ goto restart; } } }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,858
PointInBorderSize(WindowPtr pWin, int x, int y) { BoxRec box; if (RegionContainsPoint(&pWin->borderSize, x, y, &box)) return TRUE; #ifdef PANORAMIX if (!noPanoramiXExtension && XineramaSetWindowPntrs(inputInfo.pointer, pWin)) { SpritePtr pSprite = inputInfo.pointer->spriteInfo->sprite; int i; FOR_NSCREENS_FORWARD_SKIP(i) { if (RegionContainsPoint(&pSprite->windows[i]->borderSize, x + screenInfo.screens[0]->x - screenInfo.screens[i]->x, y + screenInfo.screens[0]->y - screenInfo.screens[i]->y, &box)) return TRUE; } } #endif return FALSE; }
Exec Code Overflow
0
PointInBorderSize(WindowPtr pWin, int x, int y) { BoxRec box; if (RegionContainsPoint(&pWin->borderSize, x, y, &box)) return TRUE; #ifdef PANORAMIX if (!noPanoramiXExtension && XineramaSetWindowPntrs(inputInfo.pointer, pWin)) { SpritePtr pSprite = inputInfo.pointer->spriteInfo->sprite; int i; FOR_NSCREENS_FORWARD_SKIP(i) { if (RegionContainsPoint(&pSprite->windows[i]->borderSize, x + screenInfo.screens[0]->x - screenInfo.screens[i]->x, y + screenInfo.screens[0]->y - screenInfo.screens[i]->y, &box)) return TRUE; } } #endif return FALSE; }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,859
PostNewCursor(DeviceIntPtr pDev) { WindowPtr win; GrabPtr grab = pDev->deviceGrab.grab; SpritePtr pSprite = pDev->spriteInfo->sprite; CursorPtr pCursor; if (syncEvents.playingEvents) return; if (grab) { if (grab->cursor) { ChangeToCursor(pDev, grab->cursor); return; } if (IsParent(grab->window, pSprite->win)) win = pSprite->win; else win = grab->window; } else win = pSprite->win; for (; win; win = win->parent) { if (win->optional) { pCursor = WindowGetDeviceCursor(win, pDev); if (!pCursor && win->optional->cursor != NullCursor) pCursor = win->optional->cursor; if (pCursor) { ChangeToCursor(pDev, pCursor); return; } } } }
Exec Code Overflow
0
PostNewCursor(DeviceIntPtr pDev) { WindowPtr win; GrabPtr grab = pDev->deviceGrab.grab; SpritePtr pSprite = pDev->spriteInfo->sprite; CursorPtr pCursor; if (syncEvents.playingEvents) return; if (grab) { if (grab->cursor) { ChangeToCursor(pDev, grab->cursor); return; } if (IsParent(grab->window, pSprite->win)) win = pSprite->win; else win = grab->window; } else win = pSprite->win; for (; win; win = win->parent) { if (win->optional) { pCursor = WindowGetDeviceCursor(win, pDev); if (!pCursor && win->optional->cursor != NullCursor) pCursor = win->optional->cursor; if (pCursor) { ChangeToCursor(pDev, pCursor); return; } } } }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,860
ProcAllowEvents(ClientPtr client) { TimeStamp time; DeviceIntPtr mouse = NULL; DeviceIntPtr keybd = NULL; REQUEST(xAllowEventsReq); REQUEST_SIZE_MATCH(xAllowEventsReq); UpdateCurrentTime(); time = ClientTimeToServerTime(stuff->time); mouse = PickPointer(client); keybd = PickKeyboard(client); switch (stuff->mode) { case ReplayPointer: AllowSome(client, time, mouse, NOT_GRABBED); break; case SyncPointer: AllowSome(client, time, mouse, FREEZE_NEXT_EVENT); break; case AsyncPointer: AllowSome(client, time, mouse, THAWED); break; case ReplayKeyboard: AllowSome(client, time, keybd, NOT_GRABBED); break; case SyncKeyboard: AllowSome(client, time, keybd, FREEZE_NEXT_EVENT); break; case AsyncKeyboard: AllowSome(client, time, keybd, THAWED); break; case SyncBoth: AllowSome(client, time, keybd, FREEZE_BOTH_NEXT_EVENT); break; case AsyncBoth: AllowSome(client, time, keybd, THAWED_BOTH); break; default: client->errorValue = stuff->mode; return BadValue; } return Success; }
Exec Code Overflow
0
ProcAllowEvents(ClientPtr client) { TimeStamp time; DeviceIntPtr mouse = NULL; DeviceIntPtr keybd = NULL; REQUEST(xAllowEventsReq); REQUEST_SIZE_MATCH(xAllowEventsReq); UpdateCurrentTime(); time = ClientTimeToServerTime(stuff->time); mouse = PickPointer(client); keybd = PickKeyboard(client); switch (stuff->mode) { case ReplayPointer: AllowSome(client, time, mouse, NOT_GRABBED); break; case SyncPointer: AllowSome(client, time, mouse, FREEZE_NEXT_EVENT); break; case AsyncPointer: AllowSome(client, time, mouse, THAWED); break; case ReplayKeyboard: AllowSome(client, time, keybd, NOT_GRABBED); break; case SyncKeyboard: AllowSome(client, time, keybd, FREEZE_NEXT_EVENT); break; case AsyncKeyboard: AllowSome(client, time, keybd, THAWED); break; case SyncBoth: AllowSome(client, time, keybd, FREEZE_BOTH_NEXT_EVENT); break; case AsyncBoth: AllowSome(client, time, keybd, THAWED_BOTH); break; default: client->errorValue = stuff->mode; return BadValue; } return Success; }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,861
ProcChangeActivePointerGrab(ClientPtr client) { DeviceIntPtr device; GrabPtr grab; CursorPtr newCursor, oldCursor; REQUEST(xChangeActivePointerGrabReq); TimeStamp time; REQUEST_SIZE_MATCH(xChangeActivePointerGrabReq); if (stuff->eventMask & ~PointerGrabMask) { client->errorValue = stuff->eventMask; return BadValue; } if (stuff->cursor == None) newCursor = NullCursor; else { int rc = dixLookupResourceByType((void **) &newCursor, stuff->cursor, RT_CURSOR, client, DixUseAccess); if (rc != Success) { client->errorValue = stuff->cursor; return rc; } } device = PickPointer(client); grab = device->deviceGrab.grab; if (!grab) return Success; if (!SameClient(grab, client)) return Success; UpdateCurrentTime(); time = ClientTimeToServerTime(stuff->time); if ((CompareTimeStamps(time, currentTime) == LATER) || (CompareTimeStamps(time, device->deviceGrab.grabTime) == EARLIER)) return Success; oldCursor = grab->cursor; grab->cursor = RefCursor(newCursor); PostNewCursor(device); if (oldCursor) FreeCursor(oldCursor, (Cursor) 0); grab->eventMask = stuff->eventMask; return Success; }
Exec Code Overflow
0
ProcChangeActivePointerGrab(ClientPtr client) { DeviceIntPtr device; GrabPtr grab; CursorPtr newCursor, oldCursor; REQUEST(xChangeActivePointerGrabReq); TimeStamp time; REQUEST_SIZE_MATCH(xChangeActivePointerGrabReq); if (stuff->eventMask & ~PointerGrabMask) { client->errorValue = stuff->eventMask; return BadValue; } if (stuff->cursor == None) newCursor = NullCursor; else { int rc = dixLookupResourceByType((void **) &newCursor, stuff->cursor, RT_CURSOR, client, DixUseAccess); if (rc != Success) { client->errorValue = stuff->cursor; return rc; } } device = PickPointer(client); grab = device->deviceGrab.grab; if (!grab) return Success; if (!SameClient(grab, client)) return Success; UpdateCurrentTime(); time = ClientTimeToServerTime(stuff->time); if ((CompareTimeStamps(time, currentTime) == LATER) || (CompareTimeStamps(time, device->deviceGrab.grabTime) == EARLIER)) return Success; oldCursor = grab->cursor; grab->cursor = RefCursor(newCursor); PostNewCursor(device); if (oldCursor) FreeCursor(oldCursor, (Cursor) 0); grab->eventMask = stuff->eventMask; return Success; }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,862
ProcGetInputFocus(ClientPtr client) { DeviceIntPtr kbd = PickKeyboard(client); xGetInputFocusReply rep; FocusClassPtr focus = kbd->focus; int rc; /* REQUEST(xReq); */ REQUEST_SIZE_MATCH(xReq); rc = XaceHook(XACE_DEVICE_ACCESS, client, kbd, DixGetFocusAccess); if (rc != Success) return rc; rep = (xGetInputFocusReply) { .type = X_Reply, .length = 0, .sequenceNumber = client->sequence, .revertTo = focus->revert }; if (focus->win == NoneWin) rep.focus = None; else if (focus->win == PointerRootWin) rep.focus = PointerRoot; else rep.focus = focus->win->drawable.id; WriteReplyToClient(client, sizeof(xGetInputFocusReply), &rep); return Success; }
Exec Code Overflow
0
ProcGetInputFocus(ClientPtr client) { DeviceIntPtr kbd = PickKeyboard(client); xGetInputFocusReply rep; FocusClassPtr focus = kbd->focus; int rc; /* REQUEST(xReq); */ REQUEST_SIZE_MATCH(xReq); rc = XaceHook(XACE_DEVICE_ACCESS, client, kbd, DixGetFocusAccess); if (rc != Success) return rc; rep = (xGetInputFocusReply) { .type = X_Reply, .length = 0, .sequenceNumber = client->sequence, .revertTo = focus->revert }; if (focus->win == NoneWin) rep.focus = None; else if (focus->win == PointerRootWin) rep.focus = PointerRoot; else rep.focus = focus->win->drawable.id; WriteReplyToClient(client, sizeof(xGetInputFocusReply), &rep); return Success; }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,863
ProcGrabButton(ClientPtr client) { WindowPtr pWin, confineTo; REQUEST(xGrabButtonReq); CursorPtr cursor; GrabPtr grab; DeviceIntPtr ptr, modifierDevice; Mask access_mode = DixGrabAccess; GrabMask mask; GrabParameters param; int rc; REQUEST_SIZE_MATCH(xGrabButtonReq); UpdateCurrentTime(); if ((stuff->pointerMode != GrabModeSync) && (stuff->pointerMode != GrabModeAsync)) { client->errorValue = stuff->pointerMode; return BadValue; } if ((stuff->keyboardMode != GrabModeSync) && (stuff->keyboardMode != GrabModeAsync)) { client->errorValue = stuff->keyboardMode; return BadValue; } if ((stuff->modifiers != AnyModifier) && (stuff->modifiers & ~AllModifiersMask)) { client->errorValue = stuff->modifiers; return BadValue; } if ((stuff->ownerEvents != xFalse) && (stuff->ownerEvents != xTrue)) { client->errorValue = stuff->ownerEvents; return BadValue; } if (stuff->eventMask & ~PointerGrabMask) { client->errorValue = stuff->eventMask; return BadValue; } rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixSetAttrAccess); if (rc != Success) return rc; if (stuff->confineTo == None) confineTo = NullWindow; else { rc = dixLookupWindow(&confineTo, stuff->confineTo, client, DixSetAttrAccess); if (rc != Success) return rc; } if (stuff->cursor == None) cursor = NullCursor; else { rc = dixLookupResourceByType((void **) &cursor, stuff->cursor, RT_CURSOR, client, DixUseAccess); if (rc != Success) { client->errorValue = stuff->cursor; return rc; } access_mode |= DixForceAccess; } ptr = PickPointer(client); modifierDevice = GetMaster(ptr, MASTER_KEYBOARD); if (stuff->pointerMode == GrabModeSync || stuff->keyboardMode == GrabModeSync) access_mode |= DixFreezeAccess; rc = XaceHook(XACE_DEVICE_ACCESS, client, ptr, access_mode); if (rc != Success) return rc; param = (GrabParameters) { .grabtype = CORE, .ownerEvents = stuff->ownerEvents, .this_device_mode = stuff->keyboardMode, .other_devices_mode = stuff->pointerMode, .modifiers = stuff->modifiers }; mask.core = stuff->eventMask; grab = CreateGrab(client->index, ptr, modifierDevice, pWin, CORE, &mask, &param, ButtonPress, stuff->button, confineTo, cursor); if (!grab) return BadAlloc; return AddPassiveGrabToList(client, grab); }
Exec Code Overflow
0
ProcGrabButton(ClientPtr client) { WindowPtr pWin, confineTo; REQUEST(xGrabButtonReq); CursorPtr cursor; GrabPtr grab; DeviceIntPtr ptr, modifierDevice; Mask access_mode = DixGrabAccess; GrabMask mask; GrabParameters param; int rc; REQUEST_SIZE_MATCH(xGrabButtonReq); UpdateCurrentTime(); if ((stuff->pointerMode != GrabModeSync) && (stuff->pointerMode != GrabModeAsync)) { client->errorValue = stuff->pointerMode; return BadValue; } if ((stuff->keyboardMode != GrabModeSync) && (stuff->keyboardMode != GrabModeAsync)) { client->errorValue = stuff->keyboardMode; return BadValue; } if ((stuff->modifiers != AnyModifier) && (stuff->modifiers & ~AllModifiersMask)) { client->errorValue = stuff->modifiers; return BadValue; } if ((stuff->ownerEvents != xFalse) && (stuff->ownerEvents != xTrue)) { client->errorValue = stuff->ownerEvents; return BadValue; } if (stuff->eventMask & ~PointerGrabMask) { client->errorValue = stuff->eventMask; return BadValue; } rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixSetAttrAccess); if (rc != Success) return rc; if (stuff->confineTo == None) confineTo = NullWindow; else { rc = dixLookupWindow(&confineTo, stuff->confineTo, client, DixSetAttrAccess); if (rc != Success) return rc; } if (stuff->cursor == None) cursor = NullCursor; else { rc = dixLookupResourceByType((void **) &cursor, stuff->cursor, RT_CURSOR, client, DixUseAccess); if (rc != Success) { client->errorValue = stuff->cursor; return rc; } access_mode |= DixForceAccess; } ptr = PickPointer(client); modifierDevice = GetMaster(ptr, MASTER_KEYBOARD); if (stuff->pointerMode == GrabModeSync || stuff->keyboardMode == GrabModeSync) access_mode |= DixFreezeAccess; rc = XaceHook(XACE_DEVICE_ACCESS, client, ptr, access_mode); if (rc != Success) return rc; param = (GrabParameters) { .grabtype = CORE, .ownerEvents = stuff->ownerEvents, .this_device_mode = stuff->keyboardMode, .other_devices_mode = stuff->pointerMode, .modifiers = stuff->modifiers }; mask.core = stuff->eventMask; grab = CreateGrab(client->index, ptr, modifierDevice, pWin, CORE, &mask, &param, ButtonPress, stuff->button, confineTo, cursor); if (!grab) return BadAlloc; return AddPassiveGrabToList(client, grab); }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,864
ProcGrabKeyboard(ClientPtr client) { xGrabKeyboardReply rep; BYTE status; REQUEST(xGrabKeyboardReq); int result; DeviceIntPtr keyboard = PickKeyboard(client); GrabMask mask; REQUEST_SIZE_MATCH(xGrabKeyboardReq); UpdateCurrentTime(); mask.core = KeyPressMask | KeyReleaseMask; result = GrabDevice(client, keyboard, stuff->pointerMode, stuff->keyboardMode, stuff->grabWindow, stuff->ownerEvents, stuff->time, &mask, CORE, None, None, &status); if (result != Success) return result; rep = (xGrabKeyboardReply) { .type = X_Reply, .status = status, .sequenceNumber = client->sequence, .length = 0 }; WriteReplyToClient(client, sizeof(xGrabKeyboardReply), &rep); return Success; }
Exec Code Overflow
0
ProcGrabKeyboard(ClientPtr client) { xGrabKeyboardReply rep; BYTE status; REQUEST(xGrabKeyboardReq); int result; DeviceIntPtr keyboard = PickKeyboard(client); GrabMask mask; REQUEST_SIZE_MATCH(xGrabKeyboardReq); UpdateCurrentTime(); mask.core = KeyPressMask | KeyReleaseMask; result = GrabDevice(client, keyboard, stuff->pointerMode, stuff->keyboardMode, stuff->grabWindow, stuff->ownerEvents, stuff->time, &mask, CORE, None, None, &status); if (result != Success) return result; rep = (xGrabKeyboardReply) { .type = X_Reply, .status = status, .sequenceNumber = client->sequence, .length = 0 }; WriteReplyToClient(client, sizeof(xGrabKeyboardReply), &rep); return Success; }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,865
ProcGrabPointer(ClientPtr client) { xGrabPointerReply rep; DeviceIntPtr device = PickPointer(client); GrabPtr grab; GrabMask mask; WindowPtr confineTo; BYTE status; REQUEST(xGrabPointerReq); int rc; REQUEST_SIZE_MATCH(xGrabPointerReq); UpdateCurrentTime(); if (stuff->eventMask & ~PointerGrabMask) { client->errorValue = stuff->eventMask; return BadValue; } if (stuff->confineTo == None) confineTo = NullWindow; else { rc = dixLookupWindow(&confineTo, stuff->confineTo, client, DixSetAttrAccess); if (rc != Success) return rc; } grab = device->deviceGrab.grab; if (grab && grab->confineTo && !confineTo) ConfineCursorToWindow(device, GetCurrentRootWindow(device), FALSE, FALSE); mask.core = stuff->eventMask; rc = GrabDevice(client, device, stuff->pointerMode, stuff->keyboardMode, stuff->grabWindow, stuff->ownerEvents, stuff->time, &mask, CORE, stuff->cursor, stuff->confineTo, &status); if (rc != Success) return rc; rep = (xGrabPointerReply) { .type = X_Reply, .status = status, .sequenceNumber = client->sequence, .length = 0 }; WriteReplyToClient(client, sizeof(xGrabPointerReply), &rep); return Success; }
Exec Code Overflow
0
ProcGrabPointer(ClientPtr client) { xGrabPointerReply rep; DeviceIntPtr device = PickPointer(client); GrabPtr grab; GrabMask mask; WindowPtr confineTo; BYTE status; REQUEST(xGrabPointerReq); int rc; REQUEST_SIZE_MATCH(xGrabPointerReq); UpdateCurrentTime(); if (stuff->eventMask & ~PointerGrabMask) { client->errorValue = stuff->eventMask; return BadValue; } if (stuff->confineTo == None) confineTo = NullWindow; else { rc = dixLookupWindow(&confineTo, stuff->confineTo, client, DixSetAttrAccess); if (rc != Success) return rc; } grab = device->deviceGrab.grab; if (grab && grab->confineTo && !confineTo) ConfineCursorToWindow(device, GetCurrentRootWindow(device), FALSE, FALSE); mask.core = stuff->eventMask; rc = GrabDevice(client, device, stuff->pointerMode, stuff->keyboardMode, stuff->grabWindow, stuff->ownerEvents, stuff->time, &mask, CORE, stuff->cursor, stuff->confineTo, &status); if (rc != Success) return rc; rep = (xGrabPointerReply) { .type = X_Reply, .status = status, .sequenceNumber = client->sequence, .length = 0 }; WriteReplyToClient(client, sizeof(xGrabPointerReply), &rep); return Success; }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,866
ProcQueryPointer(ClientPtr client) { xQueryPointerReply rep; WindowPtr pWin, t; DeviceIntPtr mouse = PickPointer(client); DeviceIntPtr keyboard; SpritePtr pSprite; int rc; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); rc = dixLookupWindow(&pWin, stuff->id, client, DixGetAttrAccess); if (rc != Success) return rc; rc = XaceHook(XACE_DEVICE_ACCESS, client, mouse, DixReadAccess); if (rc != Success && rc != BadAccess) return rc; keyboard = GetMaster(mouse, MASTER_KEYBOARD); pSprite = mouse->spriteInfo->sprite; if (mouse->valuator->motionHintWindow) MaybeStopHint(mouse, client); rep = (xQueryPointerReply) { .type = X_Reply, .sequenceNumber = client->sequence, .length = 0, .mask = event_get_corestate(mouse, keyboard), .root = (GetCurrentRootWindow(mouse))->drawable.id, .rootX = pSprite->hot.x, .rootY = pSprite->hot.y, .child = None }; if (pSprite->hot.pScreen == pWin->drawable.pScreen) { rep.sameScreen = xTrue; rep.winX = pSprite->hot.x - pWin->drawable.x; rep.winY = pSprite->hot.y - pWin->drawable.y; for (t = pSprite->win; t; t = t->parent) if (t->parent == pWin) { rep.child = t->drawable.id; break; } } else { rep.sameScreen = xFalse; rep.winX = 0; rep.winY = 0; } #ifdef PANORAMIX if (!noPanoramiXExtension) { rep.rootX += screenInfo.screens[0]->x; rep.rootY += screenInfo.screens[0]->y; if (stuff->id == rep.root) { rep.winX += screenInfo.screens[0]->x; rep.winY += screenInfo.screens[0]->y; } } #endif if (rc == BadAccess) { rep.mask = 0; rep.child = None; rep.rootX = 0; rep.rootY = 0; rep.winX = 0; rep.winY = 0; } WriteReplyToClient(client, sizeof(xQueryPointerReply), &rep); return Success; }
Exec Code Overflow
0
ProcQueryPointer(ClientPtr client) { xQueryPointerReply rep; WindowPtr pWin, t; DeviceIntPtr mouse = PickPointer(client); DeviceIntPtr keyboard; SpritePtr pSprite; int rc; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); rc = dixLookupWindow(&pWin, stuff->id, client, DixGetAttrAccess); if (rc != Success) return rc; rc = XaceHook(XACE_DEVICE_ACCESS, client, mouse, DixReadAccess); if (rc != Success && rc != BadAccess) return rc; keyboard = GetMaster(mouse, MASTER_KEYBOARD); pSprite = mouse->spriteInfo->sprite; if (mouse->valuator->motionHintWindow) MaybeStopHint(mouse, client); rep = (xQueryPointerReply) { .type = X_Reply, .sequenceNumber = client->sequence, .length = 0, .mask = event_get_corestate(mouse, keyboard), .root = (GetCurrentRootWindow(mouse))->drawable.id, .rootX = pSprite->hot.x, .rootY = pSprite->hot.y, .child = None }; if (pSprite->hot.pScreen == pWin->drawable.pScreen) { rep.sameScreen = xTrue; rep.winX = pSprite->hot.x - pWin->drawable.x; rep.winY = pSprite->hot.y - pWin->drawable.y; for (t = pSprite->win; t; t = t->parent) if (t->parent == pWin) { rep.child = t->drawable.id; break; } } else { rep.sameScreen = xFalse; rep.winX = 0; rep.winY = 0; } #ifdef PANORAMIX if (!noPanoramiXExtension) { rep.rootX += screenInfo.screens[0]->x; rep.rootY += screenInfo.screens[0]->y; if (stuff->id == rep.root) { rep.winX += screenInfo.screens[0]->x; rep.winY += screenInfo.screens[0]->y; } } #endif if (rc == BadAccess) { rep.mask = 0; rep.child = None; rep.rootX = 0; rep.rootY = 0; rep.winX = 0; rep.winY = 0; } WriteReplyToClient(client, sizeof(xQueryPointerReply), &rep); return Success; }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,867
ProcRecolorCursor(ClientPtr client) { CursorPtr pCursor; int rc, nscr; ScreenPtr pscr; Bool displayed; SpritePtr pSprite = PickPointer(client)->spriteInfo->sprite; REQUEST(xRecolorCursorReq); REQUEST_SIZE_MATCH(xRecolorCursorReq); rc = dixLookupResourceByType((void **) &pCursor, stuff->cursor, RT_CURSOR, client, DixWriteAccess); if (rc != Success) { client->errorValue = stuff->cursor; return rc; } pCursor->foreRed = stuff->foreRed; pCursor->foreGreen = stuff->foreGreen; pCursor->foreBlue = stuff->foreBlue; pCursor->backRed = stuff->backRed; pCursor->backGreen = stuff->backGreen; pCursor->backBlue = stuff->backBlue; for (nscr = 0; nscr < screenInfo.numScreens; nscr++) { pscr = screenInfo.screens[nscr]; #ifdef PANORAMIX if (!noPanoramiXExtension) displayed = (pscr == pSprite->screen); else #endif displayed = (pscr == pSprite->hotPhys.pScreen); (*pscr->RecolorCursor) (PickPointer(client), pscr, pCursor, (pCursor == pSprite->current) && displayed); } return Success; }
Exec Code Overflow
0
ProcRecolorCursor(ClientPtr client) { CursorPtr pCursor; int rc, nscr; ScreenPtr pscr; Bool displayed; SpritePtr pSprite = PickPointer(client)->spriteInfo->sprite; REQUEST(xRecolorCursorReq); REQUEST_SIZE_MATCH(xRecolorCursorReq); rc = dixLookupResourceByType((void **) &pCursor, stuff->cursor, RT_CURSOR, client, DixWriteAccess); if (rc != Success) { client->errorValue = stuff->cursor; return rc; } pCursor->foreRed = stuff->foreRed; pCursor->foreGreen = stuff->foreGreen; pCursor->foreBlue = stuff->foreBlue; pCursor->backRed = stuff->backRed; pCursor->backGreen = stuff->backGreen; pCursor->backBlue = stuff->backBlue; for (nscr = 0; nscr < screenInfo.numScreens; nscr++) { pscr = screenInfo.screens[nscr]; #ifdef PANORAMIX if (!noPanoramiXExtension) displayed = (pscr == pSprite->screen); else #endif displayed = (pscr == pSprite->hotPhys.pScreen); (*pscr->RecolorCursor) (PickPointer(client), pscr, pCursor, (pCursor == pSprite->current) && displayed); } return Success; }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,868
ProcSetInputFocus(ClientPtr client) { DeviceIntPtr kbd = PickKeyboard(client); REQUEST(xSetInputFocusReq); REQUEST_SIZE_MATCH(xSetInputFocusReq); return SetInputFocus(client, kbd, stuff->focus, stuff->revertTo, stuff->time, FALSE); }
Exec Code Overflow
0
ProcSetInputFocus(ClientPtr client) { DeviceIntPtr kbd = PickKeyboard(client); REQUEST(xSetInputFocusReq); REQUEST_SIZE_MATCH(xSetInputFocusReq); return SetInputFocus(client, kbd, stuff->focus, stuff->revertTo, stuff->time, FALSE); }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,869
ProcUngrabButton(ClientPtr client) { REQUEST(xUngrabButtonReq); WindowPtr pWin; GrabPtr tempGrab; int rc; DeviceIntPtr ptr; REQUEST_SIZE_MATCH(xUngrabButtonReq); UpdateCurrentTime(); if ((stuff->modifiers != AnyModifier) && (stuff->modifiers & ~AllModifiersMask)) { client->errorValue = stuff->modifiers; return BadValue; } rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixReadAccess); if (rc != Success) return rc; ptr = PickPointer(client); tempGrab = AllocGrab(NULL); if (!tempGrab) return BadAlloc; tempGrab->resource = client->clientAsMask; tempGrab->device = ptr; tempGrab->window = pWin; tempGrab->modifiersDetail.exact = stuff->modifiers; tempGrab->modifiersDetail.pMask = NULL; tempGrab->modifierDevice = GetMaster(ptr, MASTER_KEYBOARD); tempGrab->type = ButtonPress; tempGrab->detail.exact = stuff->button; tempGrab->grabtype = CORE; tempGrab->detail.pMask = NULL; tempGrab->next = NULL; if (!DeletePassiveGrabFromList(tempGrab)) rc = BadAlloc; FreeGrab(tempGrab); return rc; }
Exec Code Overflow
0
ProcUngrabButton(ClientPtr client) { REQUEST(xUngrabButtonReq); WindowPtr pWin; GrabPtr tempGrab; int rc; DeviceIntPtr ptr; REQUEST_SIZE_MATCH(xUngrabButtonReq); UpdateCurrentTime(); if ((stuff->modifiers != AnyModifier) && (stuff->modifiers & ~AllModifiersMask)) { client->errorValue = stuff->modifiers; return BadValue; } rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixReadAccess); if (rc != Success) return rc; ptr = PickPointer(client); tempGrab = AllocGrab(NULL); if (!tempGrab) return BadAlloc; tempGrab->resource = client->clientAsMask; tempGrab->device = ptr; tempGrab->window = pWin; tempGrab->modifiersDetail.exact = stuff->modifiers; tempGrab->modifiersDetail.pMask = NULL; tempGrab->modifierDevice = GetMaster(ptr, MASTER_KEYBOARD); tempGrab->type = ButtonPress; tempGrab->detail.exact = stuff->button; tempGrab->grabtype = CORE; tempGrab->detail.pMask = NULL; tempGrab->next = NULL; if (!DeletePassiveGrabFromList(tempGrab)) rc = BadAlloc; FreeGrab(tempGrab); return rc; }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,870
ProcUngrabKey(ClientPtr client) { REQUEST(xUngrabKeyReq); WindowPtr pWin; GrabPtr tempGrab; DeviceIntPtr keybd = PickKeyboard(client); int rc; REQUEST_SIZE_MATCH(xUngrabKeyReq); rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixGetAttrAccess); if (rc != Success) return rc; if (((stuff->key > keybd->key->xkbInfo->desc->max_key_code) || (stuff->key < keybd->key->xkbInfo->desc->min_key_code)) && (stuff->key != AnyKey)) { client->errorValue = stuff->key; return BadValue; } if ((stuff->modifiers != AnyModifier) && (stuff->modifiers & ~AllModifiersMask)) { client->errorValue = stuff->modifiers; return BadValue; } tempGrab = AllocGrab(NULL); if (!tempGrab) return BadAlloc; tempGrab->resource = client->clientAsMask; tempGrab->device = keybd; tempGrab->window = pWin; tempGrab->modifiersDetail.exact = stuff->modifiers; tempGrab->modifiersDetail.pMask = NULL; tempGrab->modifierDevice = keybd; tempGrab->type = KeyPress; tempGrab->grabtype = CORE; tempGrab->detail.exact = stuff->key; tempGrab->detail.pMask = NULL; tempGrab->next = NULL; if (!DeletePassiveGrabFromList(tempGrab)) rc = BadAlloc; FreeGrab(tempGrab); return rc; }
Exec Code Overflow
0
ProcUngrabKey(ClientPtr client) { REQUEST(xUngrabKeyReq); WindowPtr pWin; GrabPtr tempGrab; DeviceIntPtr keybd = PickKeyboard(client); int rc; REQUEST_SIZE_MATCH(xUngrabKeyReq); rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixGetAttrAccess); if (rc != Success) return rc; if (((stuff->key > keybd->key->xkbInfo->desc->max_key_code) || (stuff->key < keybd->key->xkbInfo->desc->min_key_code)) && (stuff->key != AnyKey)) { client->errorValue = stuff->key; return BadValue; } if ((stuff->modifiers != AnyModifier) && (stuff->modifiers & ~AllModifiersMask)) { client->errorValue = stuff->modifiers; return BadValue; } tempGrab = AllocGrab(NULL); if (!tempGrab) return BadAlloc; tempGrab->resource = client->clientAsMask; tempGrab->device = keybd; tempGrab->window = pWin; tempGrab->modifiersDetail.exact = stuff->modifiers; tempGrab->modifiersDetail.pMask = NULL; tempGrab->modifierDevice = keybd; tempGrab->type = KeyPress; tempGrab->grabtype = CORE; tempGrab->detail.exact = stuff->key; tempGrab->detail.pMask = NULL; tempGrab->next = NULL; if (!DeletePassiveGrabFromList(tempGrab)) rc = BadAlloc; FreeGrab(tempGrab); return rc; }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,871
ProcUngrabKeyboard(ClientPtr client) { DeviceIntPtr device = PickKeyboard(client); GrabPtr grab; TimeStamp time; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); UpdateCurrentTime(); grab = device->deviceGrab.grab; time = ClientTimeToServerTime(stuff->id); if ((CompareTimeStamps(time, currentTime) != LATER) && (CompareTimeStamps(time, device->deviceGrab.grabTime) != EARLIER) && (grab) && SameClient(grab, client) && grab->grabtype == CORE) (*device->deviceGrab.DeactivateGrab) (device); return Success; }
Exec Code Overflow
0
ProcUngrabKeyboard(ClientPtr client) { DeviceIntPtr device = PickKeyboard(client); GrabPtr grab; TimeStamp time; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); UpdateCurrentTime(); grab = device->deviceGrab.grab; time = ClientTimeToServerTime(stuff->id); if ((CompareTimeStamps(time, currentTime) != LATER) && (CompareTimeStamps(time, device->deviceGrab.grabTime) != EARLIER) && (grab) && SameClient(grab, client) && grab->grabtype == CORE) (*device->deviceGrab.DeactivateGrab) (device); return Success; }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,872
ProcUngrabPointer(ClientPtr client) { DeviceIntPtr device = PickPointer(client); GrabPtr grab; TimeStamp time; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); UpdateCurrentTime(); grab = device->deviceGrab.grab; time = ClientTimeToServerTime(stuff->id); if ((CompareTimeStamps(time, currentTime) != LATER) && (CompareTimeStamps(time, device->deviceGrab.grabTime) != EARLIER) && (grab) && SameClient(grab, client)) (*device->deviceGrab.DeactivateGrab) (device); return Success; }
Exec Code Overflow
0
ProcUngrabPointer(ClientPtr client) { DeviceIntPtr device = PickPointer(client); GrabPtr grab; TimeStamp time; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); UpdateCurrentTime(); grab = device->deviceGrab.grab; time = ClientTimeToServerTime(stuff->id); if ((CompareTimeStamps(time, currentTime) != LATER) && (CompareTimeStamps(time, device->deviceGrab.grabTime) != EARLIER) && (grab) && SameClient(grab, client)) (*device->deviceGrab.DeactivateGrab) (device); return Success; }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,873
ProcWarpPointer(ClientPtr client) { WindowPtr dest = NULL; int x, y, rc; ScreenPtr newScreen; DeviceIntPtr dev, tmp; SpritePtr pSprite; REQUEST(xWarpPointerReq); REQUEST_SIZE_MATCH(xWarpPointerReq); dev = PickPointer(client); for (tmp = inputInfo.devices; tmp; tmp = tmp->next) { if (GetMaster(tmp, MASTER_ATTACHED) == dev) { rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixWriteAccess); if (rc != Success) return rc; } } if (dev->lastSlave) dev = dev->lastSlave; pSprite = dev->spriteInfo->sprite; #ifdef PANORAMIX if (!noPanoramiXExtension) return XineramaWarpPointer(client); #endif if (stuff->dstWid != None) { rc = dixLookupWindow(&dest, stuff->dstWid, client, DixGetAttrAccess); if (rc != Success) return rc; } x = pSprite->hotPhys.x; y = pSprite->hotPhys.y; if (stuff->srcWid != None) { int winX, winY; XID winID = stuff->srcWid; WindowPtr source; rc = dixLookupWindow(&source, winID, client, DixGetAttrAccess); if (rc != Success) return rc; winX = source->drawable.x; winY = source->drawable.y; if (source->drawable.pScreen != pSprite->hotPhys.pScreen || x < winX + stuff->srcX || y < winY + stuff->srcY || (stuff->srcWidth != 0 && winX + stuff->srcX + (int) stuff->srcWidth < x) || (stuff->srcHeight != 0 && winY + stuff->srcY + (int) stuff->srcHeight < y) || (source->parent && !PointInWindowIsVisible(source, x, y))) return Success; } if (dest) { x = dest->drawable.x; y = dest->drawable.y; newScreen = dest->drawable.pScreen; } else newScreen = pSprite->hotPhys.pScreen; x += stuff->dstX; y += stuff->dstY; if (x < 0) x = 0; else if (x >= newScreen->width) x = newScreen->width - 1; if (y < 0) y = 0; else if (y >= newScreen->height) y = newScreen->height - 1; if (newScreen == pSprite->hotPhys.pScreen) { if (x < pSprite->physLimits.x1) x = pSprite->physLimits.x1; else if (x >= pSprite->physLimits.x2) x = pSprite->physLimits.x2 - 1; if (y < pSprite->physLimits.y1) y = pSprite->physLimits.y1; else if (y >= pSprite->physLimits.y2) y = pSprite->physLimits.y2 - 1; if (pSprite->hotShape) ConfineToShape(dev, pSprite->hotShape, &x, &y); (*newScreen->SetCursorPosition) (dev, newScreen, x, y, TRUE); } else if (!PointerConfinedToScreen(dev)) { NewCurrentScreen(dev, newScreen, x, y); } if (*newScreen->CursorWarpedTo) (*newScreen->CursorWarpedTo) (dev, newScreen, client, dest, pSprite, x, y); return Success; }
Exec Code Overflow
0
ProcWarpPointer(ClientPtr client) { WindowPtr dest = NULL; int x, y, rc; ScreenPtr newScreen; DeviceIntPtr dev, tmp; SpritePtr pSprite; REQUEST(xWarpPointerReq); REQUEST_SIZE_MATCH(xWarpPointerReq); dev = PickPointer(client); for (tmp = inputInfo.devices; tmp; tmp = tmp->next) { if (GetMaster(tmp, MASTER_ATTACHED) == dev) { rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixWriteAccess); if (rc != Success) return rc; } } if (dev->lastSlave) dev = dev->lastSlave; pSprite = dev->spriteInfo->sprite; #ifdef PANORAMIX if (!noPanoramiXExtension) return XineramaWarpPointer(client); #endif if (stuff->dstWid != None) { rc = dixLookupWindow(&dest, stuff->dstWid, client, DixGetAttrAccess); if (rc != Success) return rc; } x = pSprite->hotPhys.x; y = pSprite->hotPhys.y; if (stuff->srcWid != None) { int winX, winY; XID winID = stuff->srcWid; WindowPtr source; rc = dixLookupWindow(&source, winID, client, DixGetAttrAccess); if (rc != Success) return rc; winX = source->drawable.x; winY = source->drawable.y; if (source->drawable.pScreen != pSprite->hotPhys.pScreen || x < winX + stuff->srcX || y < winY + stuff->srcY || (stuff->srcWidth != 0 && winX + stuff->srcX + (int) stuff->srcWidth < x) || (stuff->srcHeight != 0 && winY + stuff->srcY + (int) stuff->srcHeight < y) || (source->parent && !PointInWindowIsVisible(source, x, y))) return Success; } if (dest) { x = dest->drawable.x; y = dest->drawable.y; newScreen = dest->drawable.pScreen; } else newScreen = pSprite->hotPhys.pScreen; x += stuff->dstX; y += stuff->dstY; if (x < 0) x = 0; else if (x >= newScreen->width) x = newScreen->width - 1; if (y < 0) y = 0; else if (y >= newScreen->height) y = newScreen->height - 1; if (newScreen == pSprite->hotPhys.pScreen) { if (x < pSprite->physLimits.x1) x = pSprite->physLimits.x1; else if (x >= pSprite->physLimits.x2) x = pSprite->physLimits.x2 - 1; if (y < pSprite->physLimits.y1) y = pSprite->physLimits.y1; else if (y >= pSprite->physLimits.y2) y = pSprite->physLimits.y2 - 1; if (pSprite->hotShape) ConfineToShape(dev, pSprite->hotShape, &x, &y); (*newScreen->SetCursorPosition) (dev, newScreen, x, y, TRUE); } else if (!PointerConfinedToScreen(dev)) { NewCurrentScreen(dev, newScreen, x, y); } if (*newScreen->CursorWarpedTo) (*newScreen->CursorWarpedTo) (dev, newScreen, client, dest, pSprite, x, y); return Success; }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,874
ReattachToOldMaster(DeviceIntPtr dev) { DeviceIntPtr master = NULL; if (IsMaster(dev)) return; dixLookupDevice(&master, dev->saved_master_id, serverClient, DixUseAccess); if (master) { AttachDevice(serverClient, dev, master); dev->saved_master_id = 0; } }
Exec Code Overflow
0
ReattachToOldMaster(DeviceIntPtr dev) { DeviceIntPtr master = NULL; if (IsMaster(dev)) return; dixLookupDevice(&master, dev->saved_master_id, serverClient, DixUseAccess); if (master) { AttachDevice(serverClient, dev, master); dev->saved_master_id = 0; } }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,875
RecalculateDeliverableEvents(WindowPtr pWin) { OtherClients *others; WindowPtr pChild; pChild = pWin; while (1) { if (pChild->optional) { pChild->optional->otherEventMasks = 0; for (others = wOtherClients(pChild); others; others = others->next) { pChild->optional->otherEventMasks |= others->mask; } } pChild->deliverableEvents = pChild->eventMask | wOtherEventMasks(pChild); if (pChild->parent) pChild->deliverableEvents |= (pChild->parent->deliverableEvents & ~wDontPropagateMask(pChild) & PropagateMask); if (pChild->firstChild) { pChild = pChild->firstChild; continue; } while (!pChild->nextSib && (pChild != pWin)) pChild = pChild->parent; if (pChild == pWin) break; pChild = pChild->nextSib; } }
Exec Code Overflow
0
RecalculateDeliverableEvents(WindowPtr pWin) { OtherClients *others; WindowPtr pChild; pChild = pWin; while (1) { if (pChild->optional) { pChild->optional->otherEventMasks = 0; for (others = wOtherClients(pChild); others; others = others->next) { pChild->optional->otherEventMasks |= others->mask; } } pChild->deliverableEvents = pChild->eventMask | wOtherEventMasks(pChild); if (pChild->parent) pChild->deliverableEvents |= (pChild->parent->deliverableEvents & ~wDontPropagateMask(pChild) & PropagateMask); if (pChild->firstChild) { pChild = pChild->firstChild; continue; } while (!pChild->nextSib && (pChild != pWin)) pChild = pChild->parent; if (pChild == pWin) break; pChild = pChild->nextSib; } }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,876
ReleaseActiveGrabs(ClientPtr client) { DeviceIntPtr dev; Bool done; /* XXX CloseDownClient should remove passive grabs before * releasing active grabs. */ do { done = TRUE; for (dev = inputInfo.devices; dev; dev = dev->next) { if (dev->deviceGrab.grab && SameClient(dev->deviceGrab.grab, client)) { (*dev->deviceGrab.DeactivateGrab) (dev); done = FALSE; } } } while (!done); }
Exec Code Overflow
0
ReleaseActiveGrabs(ClientPtr client) { DeviceIntPtr dev; Bool done; /* XXX CloseDownClient should remove passive grabs before * releasing active grabs. */ do { done = TRUE; for (dev = inputInfo.devices; dev; dev = dev->next) { if (dev->deviceGrab.grab && SameClient(dev->deviceGrab.grab, client)) { (*dev->deviceGrab.DeactivateGrab) (dev); done = FALSE; } } } while (!done); }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,877
SetClientPointer(ClientPtr client, DeviceIntPtr device) { int rc = XaceHook(XACE_DEVICE_ACCESS, client, device, DixUseAccess); if (rc != Success) return rc; if (!IsMaster(device)) { ErrorF("[dix] Need master device for ClientPointer. This is a bug.\n"); return BadDevice; } else if (!device->spriteInfo->spriteOwner) { ErrorF("[dix] Device %d does not have a sprite. " "Cannot be ClientPointer\n", device->id); return BadDevice; } client->clientPtr = device; return Success; }
Exec Code Overflow
0
SetClientPointer(ClientPtr client, DeviceIntPtr device) { int rc = XaceHook(XACE_DEVICE_ACCESS, client, device, DixUseAccess); if (rc != Success) return rc; if (!IsMaster(device)) { ErrorF("[dix] Need master device for ClientPointer. This is a bug.\n"); return BadDevice; } else if (!device->spriteInfo->spriteOwner) { ErrorF("[dix] Device %d does not have a sprite. " "Cannot be ClientPointer\n", device->id); return BadDevice; } client->clientPtr = device; return Success; }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,878
SetCriticalEvent(int event) { if (event >= MAXEVENTS) FatalError("SetCriticalEvent: bogus event number"); criticalEvents[event >> 3] |= 1 << (event & 7); }
Exec Code Overflow
0
SetCriticalEvent(int event) { if (event >= MAXEVENTS) FatalError("SetCriticalEvent: bogus event number"); criticalEvents[event >> 3] |= 1 << (event & 7); }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,879
SetInputFocus(ClientPtr client, DeviceIntPtr dev, Window focusID, CARD8 revertTo, Time ctime, Bool followOK) { FocusClassPtr focus; WindowPtr focusWin; int mode, rc; TimeStamp time; DeviceIntPtr keybd; /* used for FollowKeyboard or FollowKeyboardWin */ UpdateCurrentTime(); if ((revertTo != RevertToParent) && (revertTo != RevertToPointerRoot) && (revertTo != RevertToNone) && ((revertTo != RevertToFollowKeyboard) || !followOK)) { client->errorValue = revertTo; return BadValue; } time = ClientTimeToServerTime(ctime); keybd = GetMaster(dev, KEYBOARD_OR_FLOAT); if ((focusID == None) || (focusID == PointerRoot)) focusWin = (WindowPtr) (long) focusID; else if ((focusID == FollowKeyboard) && followOK) { focusWin = keybd->focus->win; } else { rc = dixLookupWindow(&focusWin, focusID, client, DixSetAttrAccess); if (rc != Success) return rc; /* It is a match error to try to set the input focus to an unviewable window. */ if (!focusWin->realized) return BadMatch; } rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixSetFocusAccess); if (rc != Success) return Success; focus = dev->focus; if ((CompareTimeStamps(time, currentTime) == LATER) || (CompareTimeStamps(time, focus->time) == EARLIER)) return Success; mode = (dev->deviceGrab.grab) ? NotifyWhileGrabbed : NotifyNormal; if (focus->win == FollowKeyboardWin) { if (!ActivateFocusInGrab(dev, keybd->focus->win, focusWin)) DoFocusEvents(dev, keybd->focus->win, focusWin, mode); } else { if (!ActivateFocusInGrab(dev, focus->win, focusWin)) DoFocusEvents(dev, focus->win, focusWin, mode); } focus->time = time; focus->revert = revertTo; if (focusID == FollowKeyboard) focus->win = FollowKeyboardWin; else focus->win = focusWin; if ((focusWin == NoneWin) || (focusWin == PointerRootWin)) focus->traceGood = 0; else { int depth = 0; WindowPtr pWin; for (pWin = focusWin; pWin; pWin = pWin->parent) depth++; if (depth > focus->traceSize) { focus->traceSize = depth + 1; focus->trace = reallocarray(focus->trace, focus->traceSize, sizeof(WindowPtr)); } focus->traceGood = depth; for (pWin = focusWin, depth--; pWin; pWin = pWin->parent, depth--) focus->trace[depth] = pWin; } return Success; }
Exec Code Overflow
0
SetInputFocus(ClientPtr client, DeviceIntPtr dev, Window focusID, CARD8 revertTo, Time ctime, Bool followOK) { FocusClassPtr focus; WindowPtr focusWin; int mode, rc; TimeStamp time; DeviceIntPtr keybd; /* used for FollowKeyboard or FollowKeyboardWin */ UpdateCurrentTime(); if ((revertTo != RevertToParent) && (revertTo != RevertToPointerRoot) && (revertTo != RevertToNone) && ((revertTo != RevertToFollowKeyboard) || !followOK)) { client->errorValue = revertTo; return BadValue; } time = ClientTimeToServerTime(ctime); keybd = GetMaster(dev, KEYBOARD_OR_FLOAT); if ((focusID == None) || (focusID == PointerRoot)) focusWin = (WindowPtr) (long) focusID; else if ((focusID == FollowKeyboard) && followOK) { focusWin = keybd->focus->win; } else { rc = dixLookupWindow(&focusWin, focusID, client, DixSetAttrAccess); if (rc != Success) return rc; /* It is a match error to try to set the input focus to an unviewable window. */ if (!focusWin->realized) return BadMatch; } rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixSetFocusAccess); if (rc != Success) return Success; focus = dev->focus; if ((CompareTimeStamps(time, currentTime) == LATER) || (CompareTimeStamps(time, focus->time) == EARLIER)) return Success; mode = (dev->deviceGrab.grab) ? NotifyWhileGrabbed : NotifyNormal; if (focus->win == FollowKeyboardWin) { if (!ActivateFocusInGrab(dev, keybd->focus->win, focusWin)) DoFocusEvents(dev, keybd->focus->win, focusWin, mode); } else { if (!ActivateFocusInGrab(dev, focus->win, focusWin)) DoFocusEvents(dev, focus->win, focusWin, mode); } focus->time = time; focus->revert = revertTo; if (focusID == FollowKeyboard) focus->win = FollowKeyboardWin; else focus->win = focusWin; if ((focusWin == NoneWin) || (focusWin == PointerRootWin)) focus->traceGood = 0; else { int depth = 0; WindowPtr pWin; for (pWin = focusWin; pWin; pWin = pWin->parent) depth++; if (depth > focus->traceSize) { focus->traceSize = depth + 1; focus->trace = reallocarray(focus->trace, focus->traceSize, sizeof(WindowPtr)); } focus->traceGood = depth; for (pWin = focusWin, depth--; pWin; pWin = pWin->parent, depth--) focus->trace[depth] = pWin; } return Success; }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,880
SyntheticMotion(DeviceIntPtr dev, int x, int y) { int screenno = 0; #ifdef PANORAMIX if (!noPanoramiXExtension) screenno = dev->spriteInfo->sprite->screen->myNum; #endif PostSyntheticMotion(dev, x, y, screenno, (syncEvents.playingEvents) ? syncEvents.time. milliseconds : currentTime.milliseconds); }
Exec Code Overflow
0
SyntheticMotion(DeviceIntPtr dev, int x, int y) { int screenno = 0; #ifdef PANORAMIX if (!noPanoramiXExtension) screenno = dev->spriteInfo->sprite->screen->myNum; #endif PostSyntheticMotion(dev, x, y, screenno, (syncEvents.playingEvents) ? syncEvents.time. milliseconds : currentTime.milliseconds); }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,881
UpdateTouchesForGrab(DeviceIntPtr mouse) { int i; if (!mouse->touch || mouse->deviceGrab.fromPassiveGrab) return; for (i = 0; i < mouse->touch->num_touches; i++) { TouchPointInfoPtr ti = mouse->touch->touches + i; TouchListener *listener = &ti->listeners[0]; GrabPtr grab = mouse->deviceGrab.grab; if (ti->active && CLIENT_BITS(listener->listener) == grab->resource) { listener->listener = grab->resource; listener->level = grab->grabtype; listener->state = LISTENER_IS_OWNER; listener->window = grab->window; if (grab->grabtype == CORE || grab->grabtype == XI || !xi2mask_isset(grab->xi2mask, mouse, XI_TouchBegin)) listener->type = LISTENER_POINTER_GRAB; else listener->type = LISTENER_GRAB; if (listener->grab) FreeGrab(listener->grab); listener->grab = AllocGrab(grab); } } }
Exec Code Overflow
0
UpdateTouchesForGrab(DeviceIntPtr mouse) { int i; if (!mouse->touch || mouse->deviceGrab.fromPassiveGrab) return; for (i = 0; i < mouse->touch->num_touches; i++) { TouchPointInfoPtr ti = mouse->touch->touches + i; TouchListener *listener = &ti->listeners[0]; GrabPtr grab = mouse->deviceGrab.grab; if (ti->active && CLIENT_BITS(listener->listener) == grab->resource) { listener->listener = grab->resource; listener->level = grab->grabtype; listener->state = LISTENER_IS_OWNER; listener->window = grab->window; if (grab->grabtype == CORE || grab->grabtype == XI || !xi2mask_isset(grab->xi2mask, mouse, XI_TouchBegin)) listener->type = LISTENER_POINTER_GRAB; else listener->type = LISTENER_GRAB; if (listener->grab) FreeGrab(listener->grab); listener->grab = AllocGrab(grab); } } }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,882
WindowHasNewCursor(WindowPtr pWin) { DeviceIntPtr pDev; for (pDev = inputInfo.devices; pDev; pDev = pDev->next) if (DevHasCursor(pDev)) PostNewCursor(pDev); }
Exec Code Overflow
0
WindowHasNewCursor(WindowPtr pWin) { DeviceIntPtr pDev; for (pDev = inputInfo.devices; pDev; pDev = pDev->next) if (DevHasCursor(pDev)) PostNewCursor(pDev); }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,883
WindowXI2MaskIsset(DeviceIntPtr dev, WindowPtr win, xEvent *ev) { OtherInputMasks *inputMasks = wOtherInputMasks(win); int evtype; if (!inputMasks || xi2_get_type(ev) == 0) return 0; evtype = ((xGenericEvent *) ev)->evtype; return xi2mask_isset(inputMasks->xi2mask, dev, evtype); }
Exec Code Overflow
0
WindowXI2MaskIsset(DeviceIntPtr dev, WindowPtr win, xEvent *ev) { OtherInputMasks *inputMasks = wOtherInputMasks(win); int evtype; if (!inputMasks || xi2_get_type(ev) == 0) return 0; evtype = ((xGenericEvent *) ev)->evtype; return xi2mask_isset(inputMasks->xi2mask, dev, evtype); }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,884
WindowsRestructured(void) { DeviceIntPtr pDev = inputInfo.devices; while (pDev) { if (IsMaster(pDev) || IsFloating(pDev)) CheckMotion(NULL, pDev); pDev = pDev->next; } }
Exec Code Overflow
0
WindowsRestructured(void) { DeviceIntPtr pDev = inputInfo.devices; while (pDev) { if (IsMaster(pDev) || IsFloating(pDev)) CheckMotion(NULL, pDev); pDev = pDev->next; } }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,885
WriteEventsToClient(ClientPtr pClient, int count, xEvent *events) { #ifdef PANORAMIX xEvent eventCopy; #endif xEvent *eventTo, *eventFrom; int i, eventlength = sizeof(xEvent); if (!pClient || pClient == serverClient || pClient->clientGone) return; for (i = 0; i < count; i++) if ((events[i].u.u.type & 0x7f) != KeymapNotify) events[i].u.u.sequenceNumber = pClient->sequence; /* Let XKB rewrite the state, as it depends on client preferences. */ XkbFilterEvents(pClient, count, events); #ifdef PANORAMIX if (!noPanoramiXExtension && (screenInfo.screens[0]->x || screenInfo.screens[0]->y)) { switch (events->u.u.type) { case MotionNotify: case ButtonPress: case ButtonRelease: case KeyPress: case KeyRelease: case EnterNotify: case LeaveNotify: /* When multiple clients want the same event DeliverEventsToWindow passes the same event structure multiple times so we can't modify the one passed to us */ count = 1; /* should always be 1 */ memcpy(&eventCopy, events, sizeof(xEvent)); eventCopy.u.keyButtonPointer.rootX += screenInfo.screens[0]->x; eventCopy.u.keyButtonPointer.rootY += screenInfo.screens[0]->y; if (eventCopy.u.keyButtonPointer.event == eventCopy.u.keyButtonPointer.root) { eventCopy.u.keyButtonPointer.eventX += screenInfo.screens[0]->x; eventCopy.u.keyButtonPointer.eventY += screenInfo.screens[0]->y; } events = &eventCopy; break; default: break; } } #endif if (EventCallback) { EventInfoRec eventinfo; eventinfo.client = pClient; eventinfo.events = events; eventinfo.count = count; CallCallbacks(&EventCallback, (void *) &eventinfo); } #ifdef XSERVER_DTRACE if (XSERVER_SEND_EVENT_ENABLED()) { for (i = 0; i < count; i++) { XSERVER_SEND_EVENT(pClient->index, events[i].u.u.type, &events[i]); } } #endif /* Just a safety check to make sure we only have one GenericEvent, it just * makes things easier for me right now. (whot) */ for (i = 1; i < count; i++) { if (events[i].u.u.type == GenericEvent) { ErrorF("[dix] TryClientEvents: Only one GenericEvent at a time.\n"); return; } } if (events->u.u.type == GenericEvent) { eventlength += ((xGenericEvent *) events)->length * 4; } if (pClient->swapped) { if (eventlength > swapEventLen) { swapEventLen = eventlength; swapEvent = realloc(swapEvent, swapEventLen); if (!swapEvent) { FatalError("WriteEventsToClient: Out of memory.\n"); return; } } for (i = 0; i < count; i++) { eventFrom = &events[i]; eventTo = swapEvent; /* Remember to strip off the leading bit of type in case this event was sent with "SendEvent." */ (*EventSwapVector[eventFrom->u.u.type & 0177]) (eventFrom, eventTo); WriteToClient(pClient, eventlength, eventTo); } } else { /* only one GenericEvent, remember? that means either count is 1 and * eventlength is arbitrary or eventlength is 32 and count doesn't * matter. And we're all set. Woohoo. */ WriteToClient(pClient, count * eventlength, events); } }
Exec Code Overflow
0
WriteEventsToClient(ClientPtr pClient, int count, xEvent *events) { #ifdef PANORAMIX xEvent eventCopy; #endif xEvent *eventTo, *eventFrom; int i, eventlength = sizeof(xEvent); if (!pClient || pClient == serverClient || pClient->clientGone) return; for (i = 0; i < count; i++) if ((events[i].u.u.type & 0x7f) != KeymapNotify) events[i].u.u.sequenceNumber = pClient->sequence; /* Let XKB rewrite the state, as it depends on client preferences. */ XkbFilterEvents(pClient, count, events); #ifdef PANORAMIX if (!noPanoramiXExtension && (screenInfo.screens[0]->x || screenInfo.screens[0]->y)) { switch (events->u.u.type) { case MotionNotify: case ButtonPress: case ButtonRelease: case KeyPress: case KeyRelease: case EnterNotify: case LeaveNotify: /* When multiple clients want the same event DeliverEventsToWindow passes the same event structure multiple times so we can't modify the one passed to us */ count = 1; /* should always be 1 */ memcpy(&eventCopy, events, sizeof(xEvent)); eventCopy.u.keyButtonPointer.rootX += screenInfo.screens[0]->x; eventCopy.u.keyButtonPointer.rootY += screenInfo.screens[0]->y; if (eventCopy.u.keyButtonPointer.event == eventCopy.u.keyButtonPointer.root) { eventCopy.u.keyButtonPointer.eventX += screenInfo.screens[0]->x; eventCopy.u.keyButtonPointer.eventY += screenInfo.screens[0]->y; } events = &eventCopy; break; default: break; } } #endif if (EventCallback) { EventInfoRec eventinfo; eventinfo.client = pClient; eventinfo.events = events; eventinfo.count = count; CallCallbacks(&EventCallback, (void *) &eventinfo); } #ifdef XSERVER_DTRACE if (XSERVER_SEND_EVENT_ENABLED()) { for (i = 0; i < count; i++) { XSERVER_SEND_EVENT(pClient->index, events[i].u.u.type, &events[i]); } } #endif /* Just a safety check to make sure we only have one GenericEvent, it just * makes things easier for me right now. (whot) */ for (i = 1; i < count; i++) { if (events[i].u.u.type == GenericEvent) { ErrorF("[dix] TryClientEvents: Only one GenericEvent at a time.\n"); return; } } if (events->u.u.type == GenericEvent) { eventlength += ((xGenericEvent *) events)->length * 4; } if (pClient->swapped) { if (eventlength > swapEventLen) { swapEventLen = eventlength; swapEvent = realloc(swapEvent, swapEventLen); if (!swapEvent) { FatalError("WriteEventsToClient: Out of memory.\n"); return; } } for (i = 0; i < count; i++) { eventFrom = &events[i]; eventTo = swapEvent; /* Remember to strip off the leading bit of type in case this event was sent with "SendEvent." */ (*EventSwapVector[eventFrom->u.u.type & 0177]) (eventFrom, eventTo); WriteToClient(pClient, eventlength, eventTo); } } else { /* only one GenericEvent, remember? that means either count is 1 and * eventlength is arbitrary or eventlength is 32 and count doesn't * matter. And we're all set. Woohoo. */ WriteToClient(pClient, count * eventlength, events); } }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,886
XItoCoreType(int xitype) { int coretype = 0; if (xitype == DeviceMotionNotify) coretype = MotionNotify; else if (xitype == DeviceButtonPress) coretype = ButtonPress; else if (xitype == DeviceButtonRelease) coretype = ButtonRelease; else if (xitype == DeviceKeyPress) coretype = KeyPress; else if (xitype == DeviceKeyRelease) coretype = KeyRelease; return coretype; }
Exec Code Overflow
0
XItoCoreType(int xitype) { int coretype = 0; if (xitype == DeviceMotionNotify) coretype = MotionNotify; else if (xitype == DeviceButtonPress) coretype = ButtonPress; else if (xitype == DeviceButtonRelease) coretype = ButtonRelease; else if (xitype == DeviceKeyPress) coretype = KeyPress; else if (xitype == DeviceKeyRelease) coretype = KeyRelease; return coretype; }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,887
XineramaConfineCursorToWindow(DeviceIntPtr pDev, WindowPtr pWin, Bool generateEvents) { SpritePtr pSprite = pDev->spriteInfo->sprite; int x, y, off_x, off_y, i; if (!XineramaSetWindowPntrs(pDev, pWin)) return; i = PanoramiXNumScreens - 1; RegionCopy(&pSprite->Reg1, &pSprite->windows[i]->borderSize); off_x = screenInfo.screens[i]->x; off_y = screenInfo.screens[i]->y; while (i--) { x = off_x - screenInfo.screens[i]->x; y = off_y - screenInfo.screens[i]->y; if (x || y) RegionTranslate(&pSprite->Reg1, x, y); RegionUnion(&pSprite->Reg1, &pSprite->Reg1, &pSprite->windows[i]->borderSize); off_x = screenInfo.screens[i]->x; off_y = screenInfo.screens[i]->y; } pSprite->hotLimits = *RegionExtents(&pSprite->Reg1); if (RegionNumRects(&pSprite->Reg1) > 1) pSprite->hotShape = &pSprite->Reg1; else pSprite->hotShape = NullRegion; pSprite->confined = FALSE; pSprite->confineWin = (pWin == screenInfo.screens[0]->root) ? NullWindow : pWin; CheckPhysLimits(pDev, pSprite->current, generateEvents, FALSE, NULL); }
Exec Code Overflow
0
XineramaConfineCursorToWindow(DeviceIntPtr pDev, WindowPtr pWin, Bool generateEvents) { SpritePtr pSprite = pDev->spriteInfo->sprite; int x, y, off_x, off_y, i; if (!XineramaSetWindowPntrs(pDev, pWin)) return; i = PanoramiXNumScreens - 1; RegionCopy(&pSprite->Reg1, &pSprite->windows[i]->borderSize); off_x = screenInfo.screens[i]->x; off_y = screenInfo.screens[i]->y; while (i--) { x = off_x - screenInfo.screens[i]->x; y = off_y - screenInfo.screens[i]->y; if (x || y) RegionTranslate(&pSprite->Reg1, x, y); RegionUnion(&pSprite->Reg1, &pSprite->Reg1, &pSprite->windows[i]->borderSize); off_x = screenInfo.screens[i]->x; off_y = screenInfo.screens[i]->y; } pSprite->hotLimits = *RegionExtents(&pSprite->Reg1); if (RegionNumRects(&pSprite->Reg1) > 1) pSprite->hotShape = &pSprite->Reg1; else pSprite->hotShape = NullRegion; pSprite->confined = FALSE; pSprite->confineWin = (pWin == screenInfo.screens[0]->root) ? NullWindow : pWin; CheckPhysLimits(pDev, pSprite->current, generateEvents, FALSE, NULL); }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,888
XineramaConstrainCursor(DeviceIntPtr pDev) { SpritePtr pSprite = pDev->spriteInfo->sprite; ScreenPtr pScreen; BoxRec newBox; pScreen = pSprite->screen; newBox = pSprite->physLimits; /* Translate the constraining box to the screen the sprite is actually on */ newBox.x1 += screenInfo.screens[0]->x - pScreen->x; newBox.x2 += screenInfo.screens[0]->x - pScreen->x; newBox.y1 += screenInfo.screens[0]->y - pScreen->y; newBox.y2 += screenInfo.screens[0]->y - pScreen->y; (*pScreen->ConstrainCursor) (pDev, pScreen, &newBox); }
Exec Code Overflow
0
XineramaConstrainCursor(DeviceIntPtr pDev) { SpritePtr pSprite = pDev->spriteInfo->sprite; ScreenPtr pScreen; BoxRec newBox; pScreen = pSprite->screen; newBox = pSprite->physLimits; /* Translate the constraining box to the screen the sprite is actually on */ newBox.x1 += screenInfo.screens[0]->x - pScreen->x; newBox.x2 += screenInfo.screens[0]->x - pScreen->x; newBox.y1 += screenInfo.screens[0]->y - pScreen->y; newBox.y2 += screenInfo.screens[0]->y - pScreen->y; (*pScreen->ConstrainCursor) (pDev, pScreen, &newBox); }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,889
XineramaGetCursorScreen(DeviceIntPtr pDev) { if (!noPanoramiXExtension) { return pDev->spriteInfo->sprite->screen->myNum; } else { return 0; } }
Exec Code Overflow
0
XineramaGetCursorScreen(DeviceIntPtr pDev) { if (!noPanoramiXExtension) { return pDev->spriteInfo->sprite->screen->myNum; } else { return 0; } }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,890
XineramaPointInWindowIsVisible(WindowPtr pWin, int x, int y) { BoxRec box; int i, xoff, yoff; if (!pWin->realized) return FALSE; if (RegionContainsPoint(&pWin->borderClip, x, y, &box)) return TRUE; if (!XineramaSetWindowPntrs(inputInfo.pointer, pWin)) return FALSE; xoff = x + screenInfo.screens[0]->x; yoff = y + screenInfo.screens[0]->y; FOR_NSCREENS_FORWARD_SKIP(i) { pWin = inputInfo.pointer->spriteInfo->sprite->windows[i]; x = xoff - screenInfo.screens[i]->x; y = yoff - screenInfo.screens[i]->y; if (RegionContainsPoint(&pWin->borderClip, x, y, &box) && (!wInputShape(pWin) || RegionContainsPoint(wInputShape(pWin), x - pWin->drawable.x, y - pWin->drawable.y, &box))) return TRUE; } return FALSE; }
Exec Code Overflow
0
XineramaPointInWindowIsVisible(WindowPtr pWin, int x, int y) { BoxRec box; int i, xoff, yoff; if (!pWin->realized) return FALSE; if (RegionContainsPoint(&pWin->borderClip, x, y, &box)) return TRUE; if (!XineramaSetWindowPntrs(inputInfo.pointer, pWin)) return FALSE; xoff = x + screenInfo.screens[0]->x; yoff = y + screenInfo.screens[0]->y; FOR_NSCREENS_FORWARD_SKIP(i) { pWin = inputInfo.pointer->spriteInfo->sprite->windows[i]; x = xoff - screenInfo.screens[i]->x; y = yoff - screenInfo.screens[i]->y; if (RegionContainsPoint(&pWin->borderClip, x, y, &box) && (!wInputShape(pWin) || RegionContainsPoint(wInputShape(pWin), x - pWin->drawable.x, y - pWin->drawable.y, &box))) return TRUE; } return FALSE; }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,891
XineramaSetCursorPosition(DeviceIntPtr pDev, int x, int y, Bool generateEvent) { ScreenPtr pScreen; int i; SpritePtr pSprite = pDev->spriteInfo->sprite; /* x,y are in Screen 0 coordinates. We need to decide what Screen to send the message too and what the coordinates relative to that screen are. */ pScreen = pSprite->screen; x += screenInfo.screens[0]->x; y += screenInfo.screens[0]->y; if (!point_on_screen(pScreen, x, y)) { FOR_NSCREENS(i) { if (i == pScreen->myNum) continue; if (point_on_screen(screenInfo.screens[i], x, y)) { pScreen = screenInfo.screens[i]; break; } } } pSprite->screen = pScreen; pSprite->hotPhys.x = x - screenInfo.screens[0]->x; pSprite->hotPhys.y = y - screenInfo.screens[0]->y; x -= pScreen->x; y -= pScreen->y; return (*pScreen->SetCursorPosition) (pDev, pScreen, x, y, generateEvent); }
Exec Code Overflow
0
XineramaSetCursorPosition(DeviceIntPtr pDev, int x, int y, Bool generateEvent) { ScreenPtr pScreen; int i; SpritePtr pSprite = pDev->spriteInfo->sprite; /* x,y are in Screen 0 coordinates. We need to decide what Screen to send the message too and what the coordinates relative to that screen are. */ pScreen = pSprite->screen; x += screenInfo.screens[0]->x; y += screenInfo.screens[0]->y; if (!point_on_screen(pScreen, x, y)) { FOR_NSCREENS(i) { if (i == pScreen->myNum) continue; if (point_on_screen(screenInfo.screens[i], x, y)) { pScreen = screenInfo.screens[i]; break; } } } pSprite->screen = pScreen; pSprite->hotPhys.x = x - screenInfo.screens[0]->x; pSprite->hotPhys.y = y - screenInfo.screens[0]->y; x -= pScreen->x; y -= pScreen->y; return (*pScreen->SetCursorPosition) (pDev, pScreen, x, y, generateEvent); }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,892
XineramaSetWindowPntrs(DeviceIntPtr pDev, WindowPtr pWin) { SpritePtr pSprite = pDev->spriteInfo->sprite; if (pWin == screenInfo.screens[0]->root) { int i; FOR_NSCREENS(i) pSprite->windows[i] = screenInfo.screens[i]->root; } else { PanoramiXRes *win; int rc, i; rc = dixLookupResourceByType((void **) &win, pWin->drawable.id, XRT_WINDOW, serverClient, DixReadAccess); if (rc != Success) return FALSE; FOR_NSCREENS(i) { rc = dixLookupWindow(pSprite->windows + i, win->info[i].id, serverClient, DixReadAccess); if (rc != Success) /* window is being unmapped */ return FALSE; } } return TRUE; }
Exec Code Overflow
0
XineramaSetWindowPntrs(DeviceIntPtr pDev, WindowPtr pWin) { SpritePtr pSprite = pDev->spriteInfo->sprite; if (pWin == screenInfo.screens[0]->root) { int i; FOR_NSCREENS(i) pSprite->windows[i] = screenInfo.screens[i]->root; } else { PanoramiXRes *win; int rc, i; rc = dixLookupResourceByType((void **) &win, pWin->drawable.id, XRT_WINDOW, serverClient, DixReadAccess); if (rc != Success) return FALSE; FOR_NSCREENS(i) { rc = dixLookupWindow(pSprite->windows + i, win->info[i].id, serverClient, DixReadAccess); if (rc != Success) /* window is being unmapped */ return FALSE; } } return TRUE; }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,893
XineramaTryClientEventsResult(ClientPtr client, GrabPtr grab, Mask mask, Mask filter) { if ((client) && (client != serverClient) && (!client->clientGone) && ((filter == CantBeFiltered) || (mask & filter))) { if (grab && !SameClient(grab, client)) return -1; else return 1; } return 0; }
Exec Code Overflow
0
XineramaTryClientEventsResult(ClientPtr client, GrabPtr grab, Mask mask, Mask filter) { if ((client) && (client != serverClient) && (!client->clientGone) && ((filter == CantBeFiltered) || (mask & filter))) { if (grab && !SameClient(grab, client)) return -1; else return 1; } return 0; }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,894
XineramaWarpPointer(ClientPtr client) { WindowPtr dest = NULL; int x, y, rc; SpritePtr pSprite = PickPointer(client)->spriteInfo->sprite; REQUEST(xWarpPointerReq); if (stuff->dstWid != None) { rc = dixLookupWindow(&dest, stuff->dstWid, client, DixReadAccess); if (rc != Success) return rc; } x = pSprite->hotPhys.x; y = pSprite->hotPhys.y; if (stuff->srcWid != None) { int winX, winY; XID winID = stuff->srcWid; WindowPtr source; rc = dixLookupWindow(&source, winID, client, DixReadAccess); if (rc != Success) return rc; winX = source->drawable.x; winY = source->drawable.y; if (source == screenInfo.screens[0]->root) { winX -= screenInfo.screens[0]->x; winY -= screenInfo.screens[0]->y; } if (x < winX + stuff->srcX || y < winY + stuff->srcY || (stuff->srcWidth != 0 && winX + stuff->srcX + (int) stuff->srcWidth < x) || (stuff->srcHeight != 0 && winY + stuff->srcY + (int) stuff->srcHeight < y) || !XineramaPointInWindowIsVisible(source, x, y)) return Success; } if (dest) { x = dest->drawable.x; y = dest->drawable.y; if (dest == screenInfo.screens[0]->root) { x -= screenInfo.screens[0]->x; y -= screenInfo.screens[0]->y; } } x += stuff->dstX; y += stuff->dstY; if (x < pSprite->physLimits.x1) x = pSprite->physLimits.x1; else if (x >= pSprite->physLimits.x2) x = pSprite->physLimits.x2 - 1; if (y < pSprite->physLimits.y1) y = pSprite->physLimits.y1; else if (y >= pSprite->physLimits.y2) y = pSprite->physLimits.y2 - 1; if (pSprite->hotShape) ConfineToShape(PickPointer(client), pSprite->hotShape, &x, &y); XineramaSetCursorPosition(PickPointer(client), x, y, TRUE); return Success; }
Exec Code Overflow
0
XineramaWarpPointer(ClientPtr client) { WindowPtr dest = NULL; int x, y, rc; SpritePtr pSprite = PickPointer(client)->spriteInfo->sprite; REQUEST(xWarpPointerReq); if (stuff->dstWid != None) { rc = dixLookupWindow(&dest, stuff->dstWid, client, DixReadAccess); if (rc != Success) return rc; } x = pSprite->hotPhys.x; y = pSprite->hotPhys.y; if (stuff->srcWid != None) { int winX, winY; XID winID = stuff->srcWid; WindowPtr source; rc = dixLookupWindow(&source, winID, client, DixReadAccess); if (rc != Success) return rc; winX = source->drawable.x; winY = source->drawable.y; if (source == screenInfo.screens[0]->root) { winX -= screenInfo.screens[0]->x; winY -= screenInfo.screens[0]->y; } if (x < winX + stuff->srcX || y < winY + stuff->srcY || (stuff->srcWidth != 0 && winX + stuff->srcX + (int) stuff->srcWidth < x) || (stuff->srcHeight != 0 && winY + stuff->srcY + (int) stuff->srcHeight < y) || !XineramaPointInWindowIsVisible(source, x, y)) return Success; } if (dest) { x = dest->drawable.x; y = dest->drawable.y; if (dest == screenInfo.screens[0]->root) { x -= screenInfo.screens[0]->x; y -= screenInfo.screens[0]->y; } } x += stuff->dstX; y += stuff->dstY; if (x < pSprite->physLimits.x1) x = pSprite->physLimits.x1; else if (x >= pSprite->physLimits.x2) x = pSprite->physLimits.x2 - 1; if (y < pSprite->physLimits.y1) y = pSprite->physLimits.y1; else if (y >= pSprite->physLimits.y2) y = pSprite->physLimits.y2 - 1; if (pSprite->hotShape) ConfineToShape(PickPointer(client), pSprite->hotShape, &x, &y); XineramaSetCursorPosition(PickPointer(client), x, y, TRUE); return Success; }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,895
core_get_type(const xEvent *event) { int type = event->u.u.type; return ((type & EXTENSION_EVENT_BASE) || type == GenericEvent) ? 0 : type; }
Exec Code Overflow
0
core_get_type(const xEvent *event) { int type = event->u.u.type; return ((type & EXTENSION_EVENT_BASE) || type == GenericEvent) ? 0 : type; }
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) client->errorValue = stuff->event.u.u.type; return BadValue; } + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
CWE-119
null
null
3,896
SProcChangeProperty(ClientPtr client) { REQUEST(xChangePropertyReq); swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xChangePropertyReq); swapl(&stuff->window); swapl(&stuff->property); swapl(&stuff->type); swapl(&stuff->nUnits); switch (stuff->format) { case 8: break; case 16: SwapRestS(stuff); break; case 32: SwapRestL(stuff); break; } return ((*ProcVector[X_ChangeProperty]) (client)); }
Exec Code Overflow
0
SProcChangeProperty(ClientPtr client) { REQUEST(xChangePropertyReq); swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xChangePropertyReq); swapl(&stuff->window); swapl(&stuff->property); swapl(&stuff->type); swapl(&stuff->nUnits); switch (stuff->format) { case 8: break; case 16: SwapRestS(stuff); break; case 32: SwapRestL(stuff); break; } return ((*ProcVector[X_ChangeProperty]) (client)); }
@@ -292,6 +292,13 @@ SProcSendEvent(ClientPtr client) swapl(&stuff->destination); swapl(&stuff->eventMask); + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } + /* Swap event */ proc = EventSwapVector[stuff->event.u.u.type & 0177]; if (!proc || proc == NotImplemented) /* no swapping proc; invalid event type? */
CWE-119
null
null
3,897
SProcChangeWindowAttributes(ClientPtr client) { REQUEST(xChangeWindowAttributesReq); swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xChangeWindowAttributesReq); swapl(&stuff->window); swapl(&stuff->valueMask); SwapRestL(stuff); return ((*ProcVector[X_ChangeWindowAttributes]) (client)); }
Exec Code Overflow
0
SProcChangeWindowAttributes(ClientPtr client) { REQUEST(xChangeWindowAttributesReq); swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xChangeWindowAttributesReq); swapl(&stuff->window); swapl(&stuff->valueMask); SwapRestL(stuff); return ((*ProcVector[X_ChangeWindowAttributes]) (client)); }
@@ -292,6 +292,13 @@ SProcSendEvent(ClientPtr client) swapl(&stuff->destination); swapl(&stuff->eventMask); + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } + /* Swap event */ proc = EventSwapVector[stuff->event.u.u.type & 0177]; if (!proc || proc == NotImplemented) /* no swapping proc; invalid event type? */
CWE-119
null
null
3,898
SProcConfigureWindow(ClientPtr client) { REQUEST(xConfigureWindowReq); swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xConfigureWindowReq); swapl(&stuff->window); swaps(&stuff->mask); SwapRestL(stuff); return ((*ProcVector[X_ConfigureWindow]) (client)); }
Exec Code Overflow
0
SProcConfigureWindow(ClientPtr client) { REQUEST(xConfigureWindowReq); swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xConfigureWindowReq); swapl(&stuff->window); swaps(&stuff->mask); SwapRestL(stuff); return ((*ProcVector[X_ConfigureWindow]) (client)); }
@@ -292,6 +292,13 @@ SProcSendEvent(ClientPtr client) swapl(&stuff->destination); swapl(&stuff->eventMask); + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } + /* Swap event */ proc = EventSwapVector[stuff->event.u.u.type & 0177]; if (!proc || proc == NotImplemented) /* no swapping proc; invalid event type? */
CWE-119
null
null
3,899
SProcConvertSelection(ClientPtr client) { REQUEST(xConvertSelectionReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xConvertSelectionReq); swapl(&stuff->requestor); swapl(&stuff->selection); swapl(&stuff->target); swapl(&stuff->property); swapl(&stuff->time); return ((*ProcVector[X_ConvertSelection]) (client)); }
Exec Code Overflow
0
SProcConvertSelection(ClientPtr client) { REQUEST(xConvertSelectionReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xConvertSelectionReq); swapl(&stuff->requestor); swapl(&stuff->selection); swapl(&stuff->target); swapl(&stuff->property); swapl(&stuff->time); return ((*ProcVector[X_ConvertSelection]) (client)); }
@@ -292,6 +292,13 @@ SProcSendEvent(ClientPtr client) swapl(&stuff->destination); swapl(&stuff->eventMask); + /* Generic events can have variable size, but SendEvent request holds + exactly 32B of event data. */ + if (stuff->event.u.u.type == GenericEvent) { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } + /* Swap event */ proc = EventSwapVector[stuff->event.u.u.type & 0177]; if (!proc || proc == NotImplemented) /* no swapping proc; invalid event type? */
CWE-119
null
null