Description of problem: SDL2 crashes in wayland_get_system_cursor when hovering mouse over checkbox in 'boguex 0' application. Version-Release number of selected component (if applicable): How reproducible: Always Steps to Reproduce: 1. boguex 0 2. hover over checkbox 3. crash Actual results: I don't have a minimal C repro for this, but 'boguex 0' (an OCaml application using SDL2) reproduces this easily as soon as you hover the mouse over the checkbox: ``` Thread 1 "boguex" received signal SIGSEGV, Segmentation fault. 0x00007ffff7ee5280 in wayland_get_system_cursor (scale=<synthetic pointer>, cdata=0x165dcb0, vdata=<optimized out>) at /usr/src/debug/SDL2-2.26.0-1.fc37.x86_64/src/video/wayland/SDL_waylandmouse.c:283 283 cdata->buffer = WAYLAND_wl_cursor_image_get_buffer(cursor->images[0]); (gdb) bt #0 0x00007ffff7ee5280 in wayland_get_system_cursor (scale=<synthetic pointer>, cdata=0x165dcb0, vdata=<optimized out>) at /usr/src/debug/SDL2-2.26.0-1.fc37.x86_64/src/video/wayland/SDL_waylandmouse.c:283 #1 Wayland_ShowCursor (cursor=<optimized out>) at /usr/src/debug/SDL2-2.26.0-1.fc37.x86_64/src/video/wayland/SDL_waylandmouse.c:516 #2 0x00007ffff7d9c6d6 in ffi_call_unix64 () at ../src/x86/unix64.S:105 #3 0x00007ffff7d99492 in ffi_call_int (cif=<optimized out>, fn=<optimized out>, rvalue=<optimized out>, avalue=<optimized out>, closure=<optimized out>) at ../src/x86/ffi64.c:672 #4 0x0000000000604ec1 in ctypes_call (fnname=<optimized out>, function=<optimized out>, callspec_=<optimized out>, argwriter=<optimized out>, rvreader=<optimized out>) at /var/home/edwin/.opam/5.0.0/.opam-switch/build/ctypes.0.20.1/src/ctypes-foreign/ffi_call_stubs.c:404 #5 0x000000000063700b in <signal handler called> () #6 0x00000000005707a0 in camlCtypes_ffi__fun_1348 () at src/ctypes-foreign/ctypes_ffi.ml:111 #7 0x000000000050afdd in camlBogue__B_main__check_mouse_motion_3565 () at lib/b_main.ml:327 #8 0x000000000050dd3c in camlBogue__B_main__loop_3763 () at lib/b_main.ml:850 #9 0x000000000050e0be in camlBogue__B_main__one_step_3773 () at lib/b_main.ml:882 #10 0x000000000050eb6a in camlBogue__B_main__loop_3871 () at lib/b_main.ml:1045 #11 0x000000000050ea0c in camlBogue__B_main__run_3865 () at lib/b_main.ml:1049 #12 0x00000000005a71f0 in camlStdlib__List__iter_508 () at list.ml:110 #13 0x00000000004b0b98 in camlDune__exe__Example__entry () at examples/example.ml:1298 #14 0x0000000000498b7b in caml_program () #15 0x00000000006370c4 in <signal handler called> () #16 0x0000000000636a86 in caml_startup_common (pooling=<optimized out>, argv=0x7fffffffdc58) at runtime/startup_nat.c:129 #17 caml_startup_common (argv=0x7fffffffdc58, pooling=<optimized out>) at runtime/startup_nat.c:85 #18 0x0000000000636afb in caml_startup_exn (argv=<optimized out>) at runtime/startup_nat.c:136 #19 caml_startup (argv=<optimized out>) at runtime/startup_nat.c:141 #20 caml_main (argv=<optimized out>) at runtime/startup_nat.c:148 #21 0x000000000049821c in main (argc=<optimized out>, argv=<optimized out>) at runtime/main.c:37 ``` Unfortunately a lot of the values are optimized out, but I confirmed in gdb that trying to retrieve the cursor gives NULL, and there are no NULL pointer checks in the code: ``` (gdb) up #1 Wayland_ShowCursor (cursor=<optimized out>) at /usr/src/debug/SDL2-2.26.0-1.fc37.x86_64/src/video/wayland/SDL_waylandmouse.c:516 516 if (!wayland_get_system_cursor(d, data, &scale)) { (gdb) print *data $4 = {buffer = 0x0, surface = 0x165dcf0, hot_x = 0, hot_y = 0, w = 0, h = 0, system_cursor = SDL_SYSTEM_CURSOR_HAND, shm_data = 0x0} (gdb) down #0 0x00007ffff7ee5280 in wayland_get_system_cursor (scale=<synthetic pointer>, cdata=0x165dcb0, vdata=<optimized out>) at /usr/src/debug/SDL2-2.26.0-1.fc37.x86_64/src/video/wayland/SDL_waylandmouse.c:283 283 cdata->buffer = WAYLAND_wl_cursor_image_get_buffer(cursor->images[0]); (gdb) call WAYLAND_wl_cursor_theme_get_cursor(theme, "hand2") $5 = (struct wl_cursor *) 0x0 ``` Workaround is to use X11 driver which doesn't have these problems. Expected results: No crash Additional info: I think the following upstream commit would fix this already: https://github.com/libsdl-org/SDL/commit/5a4283134542d4bdb3d968a836387a750ce80517 I confirmed in gdb that I do get a valid cursor pointer with the call from that patch.
A workaround is to install a cursor theme package, such as 'adwaita-cursor-theme' to prevent the SIGSEGV.
This message is a reminder that Fedora Linux 37 is nearing its end of life. Fedora will stop maintaining and issuing updates for Fedora Linux 37 on 2023-12-05. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as EOL if it remains open with a 'version' of '37'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, change the 'version' to a later Fedora Linux version. Note that the version field may be hidden. Click the "Show advanced fields" button if you do not see it. Thank you for reporting this issue and we are sorry that we were not able to fix it before Fedora Linux 37 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora Linux, you are encouraged to change the 'version' to a later version prior to this bug being closed.
Fedora Linux 37 entered end-of-life (EOL) status on 2023-12-05. Fedora Linux 37 is no longer maintained, which means that it will not receive any further security or bug fix updates. As a result we are closing this bug. If you can reproduce this bug against a currently maintained version of Fedora Linux please feel free to reopen this bug against that version. Note that the version field may be hidden. Click the "Show advanced fields" button if you do not see the version field. If you are unable to reopen this bug, please file a new report against an active release. Thank you for reporting this bug and we are sorry it could not be fixed.