libretro / RetroArch

Cross-platform, sophisticated frontend for the libretro API. Licensed GPLv3.
http://www.libretro.com
GNU General Public License v3.0
10.08k stars 1.81k forks source link

Crash when pressing B button on playlists #16951

Closed zoltanvb closed 3 days ago

zoltanvb commented 1 week ago

Description

Crash when pressing B button on playlists

Expected behavior

Return to main menu

Actual behavior

Segmentation fault

Steps to reproduce the bug

  1. Start up RetroArch (XMB menu)
  2. Press left to go to last playlist (or move further left to another playlist)
  3. Press B (south) button on the controller, or Backspace on keyboard.

Bisect Results

I'll get back to this later.

Version/Commit

b74932a Does not seem to happen with last stable, 1.19.1.

Environment information

hizzlekizzle commented 1 week ago

Hmm, I'm not able to reproduce on 585e70ec6d also using linux and wayland.

zoltanvb commented 1 week ago

Still happens for me on 7602639 . Sometimes it takes a bit more presses, and seems to be related to playlist-like menu items ,as it happens also when in history.

zoltanvb commented 1 week ago

Bisect points to 11d9a841f305f37c11beabe171a42847406a22fe . I do have a Named_Logos dir that I set up for testing, but even if I get rid of it, still happens.

zoltanvb commented 1 week ago

Debugger says:

Thread 1 "retroarch" received signal SIGSEGV, Segmentation fault.
0x000000000066a82f in strlcpy_retro__ (dest=0x1 <error: Cannot access memory at address 0x1>, source=0x13637ab "jpg", size=6) at libretro-common/compat/compat_strl.c:38
38        while (--n && (*dest++ = *source++)) src_size++;
(gdb) backtrace
#0  0x000000000066a82f in strlcpy_retro__ (dest=0x1 <error: Cannot access memory at address 0x1>, source=0x13637ab "jpg", size=6)
    at libretro-common/compat/compat_strl.c:38
#1  0x00000000005d08cf in gfx_thumbnail_update_path (path_data=0x42a76b0, thumbnail_id=GFX_THUMBNAIL_ICON)
    at gfx/gfx_thumbnail_path.c:856
#2  0x00000000005d142a in gfx_thumbnail_request (path_data=0x42a76b0, thumbnail_id=GFX_THUMBNAIL_ICON, playlist=0x39d5690, idx=1, 
    thumbnail=0x42aeac8, gfx_thumbnail_upscale_threshold=0, network_on_demand_thumbnails=false) at gfx/gfx_thumbnail.c:262
#3  0x00000000005d18e5 in gfx_thumbnail_request_stream (path_data=0x42a76b0, p_anim=0x1980220 <anim_st>, 
    thumbnail_id=GFX_THUMBNAIL_ICON, playlist=0x39d5690, idx=1, thumbnail=0x42aeac8, gfx_thumbnail_upscale_threshold=0, 
    network_on_demand_thumbnails=false) at gfx/gfx_thumbnail.c:487
#4  0x0000000000794e1a in xmb_render (data=0x3acc7f0, width=5120, height=2880, is_idle=false) at menu/drivers/xmb.c:5770
#5  0x0000000000471e6c in runloop_check_state (error_on_init=false, settings=0x7ffff2c37010, current_time=3528159887)
    at runloop.c:6030
#6  0x0000000000474570 in runloop_iterate () at runloop.c:6950
#7  0x000000000045fe51 in rarch_main (argc=1, argv=0x7fffffffde68, data=0x0) at retroarch.c:5942
#8  0x000000000068284c in main (argc=1, argv=0x7fffffffde68) at ui/drivers/ui_qt.cpp:4281
(gdb) 
sonninnos commented 1 week ago

Indents and whitespaces are all over the place in that PR, so trying to read it is not fun at all..

Edit: And the PR adds uints.menu_icon_thumbnails yet it is nowhere to be found in xmb.c, so it will be doing pointless extra work even when disabled.

zoltanvb commented 1 week ago

Seems to only happen if non-PNG thumbnails are also enabled. Not sure yet why.

jbreitweiser commented 1 week ago

The issue happens when the requested image full name has not been populated into the image name field. I was not able to duplicate the issue but I have opened a pull request with an additional check that a null pointer is not passed to the copy function. @zoltanvb please test and see if you still see the issue.

zoltanvb commented 3 days ago

This is fixed by #16971 .