Bug 9803

Summary: elographics divide by zero crasher
Product: xorg Reporter: Daniel Drake <ddrake>
Component: Input/elographicsAssignee: Xorg Project Team <xorg-team>
Status: RESOLVED FIXED QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: All   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
fix none

Description Daniel Drake 2007-01-29 10:02:57 UTC
By accident, we ended up using these values for the elographics input driver:

   Option  "MaxX" "4050"
   Option  "MinX" "4051"
   Option  "MinY" "3973"
   Option  "MaxY" "3973"

With these values, X crashes when you touch the screen:

Program received signal SIGFPE, Arithmetic exception.
0x00002b6f559946f0 in xf86EloConvert (local=0x80dea0, 
    first=<value optimized out>, num=<value optimized out>, v0=2886, v1=1618, 
    v2=0, v3=0, v4=0, v5=0, x=0x7fff5764525c, y=0x7fff57645258)
    at xf86Elo.c:736
736       *y = (priv->screen_height -
(gdb) bt 
#0  0x00002b6f559946f0 in xf86EloConvert (local=0x80dea0, 
    first=<value optimized out>, num=<value optimized out>, v0=2886, v1=1618, 
    v2=0, v3=0, v4=0, v5=0, x=0x7fff5764525c, y=0x7fff57645258)
    at xf86Elo.c:736
#1  0x00002b6f55995a29 in xf86EloReadInput (local=0x80dea0) at xf86Elo.c:846
#2  0x0000000000490c6f in xf86AddEnabledDevice ()
#3  0x000000000046af2f in xf86InstallSIGIOHandler ()
#4  0x00002b6f53db35d0 in killpg () from /lib/libc.so.6
#5  0x0000000000000000 in ?? ()

The line of code in question:

  *y = (priv->screen_height -
	(priv->screen_height * (input_y - priv->min_y)) / height);

In this case, height is 0.
Comment 1 Daniel Drake 2007-01-29 10:03:27 UTC
Created attachment 8539 [details] [review]
fix

This avoids the crash by detecting the bad configuration early on and generating an error message.
Comment 2 Daniel Stone 2007-02-27 01:36:02 UTC
Sorry about the phenomenal bug spam, guys.  Adding xorg-team@ to the QA contact so bugs don't get lost in future.
Comment 3 Peter Hutterer 2007-12-27 21:57:34 UTC
Pushed as e4071358e3047127fe0476cab3e9fb63e180e940

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.