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

Segfault when highlighting/selecting cols/rows near the bottom in fullscreen SDL #138

Open
toomykins opened this issue Nov 4, 2022 · 1 comment

Comments

@toomykins
Copy link

toomykins commented Nov 4, 2022

In trying to get PDCurses full-screen, i noticed this little error where the program would give off a segmentation fault core dump when i tried to select/highlight near the bottom with my mouse.
According to gdb the error comes from _highlight() in getch.c, and i suspect it's this bit going out of bounds
curscr->_y[j][i] ^= A_REVERSE;
Probably has something to do with the way SDL handles resize_term aka PDC_resize_screen.
Happens in both versions of SDL, tested on Linux Ubuntu 20.04
quick way i tested it was by rightclicking the rain demo's title bar and selecting fullscreen on XFCE4, then trying to mouse-cursor-select down to the bottom-right.

Bill-Gray added a commit to Bill-Gray/PDCursesMod that referenced this issue Nov 4, 2022
@Bill-Gray
Copy link
Contributor

Bill-Gray commented Nov 4, 2022

I've a two-monitor system. Both are 1920x1080, but one is in portrait mode.

I could replicate this crash on the landscape-mode screen, where the bottom line is 'partial' (the screen height is not an even multiple of the font height). I couldn't replicate it on the portrait-mode screen, where there is no partial bottom line. It affected rain and other demos.

The problem arises because SDLn gets a mouse event in the partial line and (in this case) we're highlighting, say, the 42nd line on a screen with only 41 "full" lines. We just need to ignore mouse events in the partial line area (or in partial columns, should such arise).

I never noticed this before because for non-fullscreen windows, there are no partial rows or columns.

The patch I've made for PDCursesMod will need some minor modifications for PDCurses, but not much. Haven't checked yet to see if this affects X11 or (for PDCursesMod) WinGUI or DOSVGA.

Bill-Gray added a commit to Bill-Gray/PDCursesMod that referenced this issue Apr 14, 2024
… should use SP->lines, not LINES. The former will include ripped-off lines and the SLK line(s), if any.
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

2 participants