(!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) |         if (pSprite->hotShape) | ||||||
|             ConfineToShape(pSprite->hotShape, &x, &y); |             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)) { |     else if (!PointerConfinedToScreen(pDev)) { | ||||||
|         NewCurrentScreen(pDev, newScreen, x, y); |         NewCurrentScreen(pDev, newScreen, x, y); | ||||||
|  |  | ||||||
|  | @ -558,7 +558,9 @@ XineramaSetCursorPosition(DeviceIntPtr pDev, int x, int y, Bool generateEvent) | ||||||
|     x -= pScreen->x; |     x -= pScreen->x; | ||||||
|     y -= pScreen->y; |     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 | static void | ||||||
|  | @ -776,8 +778,8 @@ CheckPhysLimits(DeviceIntPtr pDev, CursorPtr cursor, Bool generateEvents, | ||||||
|         { |         { | ||||||
|             if (pScreen != pSprite->hotPhys.pScreen) |             if (pScreen != pSprite->hotPhys.pScreen) | ||||||
|                 pSprite->hotPhys = new; |                 pSprite->hotPhys = new; | ||||||
|             (*pScreen->SetCursorPosition) |             if (pScreen && pScreen->SetCursorPosition) | ||||||
|                 (pDev, pScreen, new.x, new.y, generateEvents); |                 pScreen->SetCursorPosition(pDev, pScreen, new.x, new.y, generateEvents); | ||||||
|         } |         } | ||||||
|         if (!generateEvents) |         if (!generateEvents) | ||||||
|             SyntheticMotion(pDev, new.x, new.y); |             SyntheticMotion(pDev, new.x, new.y); | ||||||
|  |  | ||||||
|  | @ -330,7 +330,8 @@ xf86RandRSetConfig(ScreenPtr pScreen, | ||||||
|                 view_adjusted = TRUE; |                 view_adjusted = TRUE; | ||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|             (*pScreen->SetCursorPosition) (dev, pScreen, px, py, FALSE); |             if (pScreen->SetCursorPosition) | ||||||
|  |                 pScreen->SetCursorPosition(dev, pScreen, px, py, FALSE); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -2393,7 +2393,9 @@ DRIAdjustFrame(ScrnInfoPtr pScrn, int x, int y) | ||||||
|             py = pScrn->frameY0; |             py = pScrn->frameY0; | ||||||
|         if (py > pScrn->frameY1) |         if (py > pScrn->frameY1) | ||||||
|             py = pScrn->frameY1; |             py = pScrn->frameY1; | ||||||
|         pScreen->SetCursorPosition(inputInfo.pointer, pScreen, px, py, TRUE); | 
 | ||||||
|  |         if (pScreen->SetCursorPosition) | ||||||
|  |             pScreen->SetCursorPosition(inputInfo.pointer, pScreen, px, py, TRUE); | ||||||
| 
 | 
 | ||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue