Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

division by 0 in processMouse() #45

Open
xtaran opened this issue Oct 20, 2022 · 0 comments
Open

division by 0 in processMouse() #45

xtaran opened this issue Oct 20, 2022 · 0 comments

Comments

@xtaran
Copy link

xtaran commented Oct 20, 2022

Reported by @jwilk in Debian as https://bugs.debian.org/1022113:

Package: gpm
Version: 1.20.7-10+b1

gpm crashes when I do "stty cols 1".

GDB says:

   Program received signal SIGFPE, Arithmetic exception.
   0x565eaf44 in processMouse (fd=5, event=0xff9a6980, type=0x565f73e0 <mice+480>, kd_mode=0) at daemon/processmouse.c:173
   173           fine_dx %= (which_mouse->opt_scale);           fine_dy %= (which_mouse->opt_scaley);
   (gdb) print which_mouse->opt_scale
   $1 = 10
   (gdb) print which_mouse->opt_scaley
   $2 = 0
   (gdb) bt
   #0  0x565eaf44 in processMouse (fd=5, event=0xff9a6980, type=0x565f73e0 <mice+480>, kd_mode=0) at daemon/processmouse.c:173
   #1  0x565e9926 in old_main () at daemon/old_main.c:200
   #2  0x565de57c in main (argc=5, argv=0xff9a6b14) at daemon/main.c:33

I think the culprit is the get_console_size() function, which does:

   (which_mouse->opt_scaley)=(which_mouse->opt_scale)*50*maxx/80/maxy;

If maxx is small and maxy is large (200 in my case), you could indeed end up
with opt_scaley set to 0.


-- System Information:
Architecture: i386

Versions of packages gpm depends on:
ii  init-system-helpers  1.65.2
ii  ucf                  3.0043
ii  debconf              1.5.79
ii  libc6                2.35-3
ii  libgpm2              1.20.7-10+b1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant