mirror of
https://github.com/X11Libre/xf86-input-elographics.git
synced 2026-03-24 01:34:03 +00:00
Bug #9803: Don't allow zero-sized width/height.
A bad configuration can result in height or width being zero. This potentially causes a divide-by-zero error in xf86EloConvert(). Detect the bad configuration early on and produce a meaningful error message. X.Org Bugzilla #9803 <https://bugs.freedesktop.org/show_bug.cgi?id=9803>
This commit is contained in:
committed by
Peter Hutterer
parent
768c173280
commit
e4071358e3
@@ -1691,6 +1691,7 @@ xf86EloInit(InputDriverPtr drv,
|
||||
EloPrivatePtr priv=NULL;
|
||||
char *str;
|
||||
int portrait = 0;
|
||||
int height, width;
|
||||
|
||||
local = xf86EloAllocate(drv);
|
||||
if (!local) {
|
||||
@@ -1757,11 +1758,21 @@ xf86EloInit(InputDriverPtr drv,
|
||||
str = "Landscape";
|
||||
}
|
||||
xf86Msg(X_CONFIG, "Elographics device will work in %s mode\n", str);
|
||||
|
||||
if (priv->max_x - priv->min_x <= 0) {
|
||||
|
||||
width = priv->max_x - priv->min_x;
|
||||
height = priv->max_y - priv->min_y;
|
||||
if (width == 0) {
|
||||
xf86Msg(X_ERROR, "Elographics: Cannot configure touchscreen with width 0\n");
|
||||
return local;
|
||||
}
|
||||
else if (width < 0) {
|
||||
xf86Msg(X_INFO, "Elographics: reverse x mode (minimum x position >= maximum x position)\n");
|
||||
}
|
||||
if (priv->max_y - priv->min_y <= 0) {
|
||||
}
|
||||
if (height == 0) {
|
||||
xf86Msg(X_ERROR, "Elographics: Cannot configure touchscreen with height 0\n");
|
||||
return local;
|
||||
}
|
||||
else if (height < 0) {
|
||||
xf86Msg(X_INFO, "Elographics: reverse y mode (minimum y position >= maximum y position)\n");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user