(!1967) dix: protect from pScreen->SetCursorPosition == NULL
It's safer not relying on all ScreenProc's actually filled.
../dix/events.c: In function ‘CheckPhysLimits’:
../dix/events.c:780:14: warning: dereference of NULL ‘pScreen’ [CWE-476] [-Wanalyzer-null-dereference]
  780 |             (*pScreen->SetCursorPosition)
      |             ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
			
			
This commit is contained in:
		
							parent
							
								
									6d22e94cb4
								
							
						
					
					
						commit
						be470cbf46
					
				|  | @ -178,7 +178,8 @@ ProcXIWarpPointer(ClientPtr client) | |||
| 
 | ||||
|         if (pSprite->hotShape) | ||||
|             ConfineToShape(pSprite->hotShape, &x, &y); | ||||
|         (*newScreen->SetCursorPosition) (pDev, newScreen, x, y, TRUE); | ||||
|         if (newScreen->SetCursorPosition) | ||||
|             newScreen->SetCursorPosition(pDev, newScreen, x, y, TRUE); | ||||
|     } | ||||
|     else if (!PointerConfinedToScreen(pDev)) { | ||||
|         NewCurrentScreen(pDev, newScreen, x, y); | ||||
|  |  | |||
|  | @ -558,7 +558,9 @@ XineramaSetCursorPosition(DeviceIntPtr pDev, int x, int y, Bool generateEvent) | |||
|     x -= pScreen->x; | ||||
|     y -= pScreen->y; | ||||
| 
 | ||||
|     return (*pScreen->SetCursorPosition) (pDev, pScreen, x, y, generateEvent); | ||||
|     if (pScreen->SetCursorPosition) | ||||
|         return pScreen->SetCursorPosition(pDev, pScreen, x, y, generateEvent); | ||||
|     return TRUE; | ||||
| } | ||||
| 
 | ||||
| static void | ||||
|  | @ -776,8 +778,8 @@ CheckPhysLimits(DeviceIntPtr pDev, CursorPtr cursor, Bool generateEvents, | |||
|         { | ||||
|             if (pScreen != pSprite->hotPhys.pScreen) | ||||
|                 pSprite->hotPhys = new; | ||||
|             (*pScreen->SetCursorPosition) | ||||
|                 (pDev, pScreen, new.x, new.y, generateEvents); | ||||
|             if (pScreen && pScreen->SetCursorPosition) | ||||
|                 pScreen->SetCursorPosition(pDev, pScreen, new.x, new.y, generateEvents); | ||||
|         } | ||||
|         if (!generateEvents) | ||||
|             SyntheticMotion(pDev, new.x, new.y); | ||||
|  |  | |||
|  | @ -330,7 +330,8 @@ xf86RandRSetConfig(ScreenPtr pScreen, | |||
|                 view_adjusted = TRUE; | ||||
|             } | ||||
| 
 | ||||
|             (*pScreen->SetCursorPosition) (dev, pScreen, px, py, FALSE); | ||||
|             if (pScreen->SetCursorPosition) | ||||
|                 pScreen->SetCursorPosition(dev, pScreen, px, py, FALSE); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -2393,6 +2393,8 @@ DRIAdjustFrame(ScrnInfoPtr pScrn, int x, int y) | |||
|             py = pScrn->frameY0; | ||||
|         if (py > pScrn->frameY1) | ||||
|             py = pScrn->frameY1; | ||||
| 
 | ||||
|         if (pScreen->SetCursorPosition) | ||||
|             pScreen->SetCursorPosition(inputInfo.pointer, pScreen, px, py, TRUE); | ||||
| 
 | ||||
|         return; | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue