XFree86 DGA: Guard against NULL pointer dereferences.

Ass, u, me ...
This commit is contained in:
Daniel Stone 2007-03-21 02:35:31 +02:00 committed by Daniel Stone
parent f292de2ef1
commit 3e9f7a5504

View File

@ -423,17 +423,19 @@ xf86PostMotionEvent(DeviceIntPtr device,
#if XFreeXDGA #if XFreeXDGA
if (first_valuator == 0 && num_valuators >= 2) { if (first_valuator == 0 && num_valuators >= 2) {
index = miPointerGetScreen(inputInfo.pointer)->myNum; if (miPointerGetScreen(inputInfo.pointer)) {
if (is_absolute) { index = miPointerGetScreen(inputInfo.pointer)->myNum;
dx = valuators[0] - device->valuator->lastx; if (is_absolute) {
dy = valuators[1] - device->valuator->lasty; dx = valuators[0] - device->valuator->lastx;
dy = valuators[1] - device->valuator->lasty;
}
else {
dx = valuators[0];
dy = valuators[1];
}
if (DGAStealMotionEvent(index, dx, dy))
goto out;
} }
else {
dx = valuators[0];
dy = valuators[1];
}
if (DGAStealMotionEvent(index, dx, dy))
goto out;
} }
#endif #endif
@ -505,9 +507,11 @@ xf86PostButtonEvent(DeviceIntPtr device,
int index; int index;
#if XFreeXDGA #if XFreeXDGA
index = miPointerGetScreen(inputInfo.pointer)->myNum; if (miPointerGetScreen(inputInfo.pointer)) {
if (DGAStealButtonEvent(index, button, is_down)) index = miPointerGetScreen(inputInfo.pointer)->myNum;
return; if (DGAStealButtonEvent(index, button, is_down))
return;
}
#endif #endif
valuators = xcalloc(sizeof(int), num_valuators); valuators = xcalloc(sizeof(int), num_valuators);
@ -588,9 +592,11 @@ xf86PostKeyboardEvent(DeviceIntPtr device,
int index; int index;
#if XFreeXDGA #if XFreeXDGA
index = miPointerGetScreen(inputInfo.pointer)->myNum; if (miPointerGetScreen(inputInfo.pointer)) {
if (DGAStealKeyEvent(index, key_code, is_down)) index = miPointerGetScreen(inputInfo.pointer)->myNum;
return; if (DGAStealKeyEvent(index, key_code, is_down))
return;
}
#endif #endif
if (!xf86Events) if (!xf86Events)