dix: don't allow keyboard devices to submit motion or button events.
GPE unconditionally dereferences pDev->valuator if a mask is present. This shouldn't really happen but if it does, don't crash, just ignore the events with an error. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Jamey Sharp <jamey@minilop.net> Reviewed-by: Daniel Stone <daniel@fooishbar.org>
This commit is contained in:
		
							parent
							
								
									bccff53318
								
							
						
					
					
						commit
						b059e06e19
					
				| 
						 | 
					@ -1099,6 +1099,11 @@ fill_pointer_events(InternalEvent *events, DeviceIntPtr pDev, int type,
 | 
				
			||||||
    switch (type)
 | 
					    switch (type)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        case MotionNotify:
 | 
					        case MotionNotify:
 | 
				
			||||||
 | 
					            if (!pDev->valuator)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                ErrorF("[dix] motion events from device %d without valuators\n", pDev->id);
 | 
				
			||||||
 | 
					                return 0;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
            if (!mask_in || valuator_mask_num_valuators(mask_in) <= 0)
 | 
					            if (!mask_in || valuator_mask_num_valuators(mask_in) <= 0)
 | 
				
			||||||
                return 0;
 | 
					                return 0;
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
| 
						 | 
					@ -1106,6 +1111,11 @@ fill_pointer_events(InternalEvent *events, DeviceIntPtr pDev, int type,
 | 
				
			||||||
        case ButtonRelease:
 | 
					        case ButtonRelease:
 | 
				
			||||||
            if (!pDev->button || !buttons)
 | 
					            if (!pDev->button || !buttons)
 | 
				
			||||||
                return 0;
 | 
					                return 0;
 | 
				
			||||||
 | 
					            if (mask_in && valuator_mask_size(mask_in) > 0 && !pDev->valuator)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                ErrorF("[dix] button event with valuator from device %d without valuators\n", pDev->id);
 | 
				
			||||||
 | 
					                return 0;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
        default:
 | 
					        default:
 | 
				
			||||||
            return 0;
 | 
					            return 0;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue