libretro / RetroArch

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

CRT SwitchRes broken in 1.18.0-2: buffer overflow error, crashes #16528

Open Gabriel2Silva opened 1 month ago

Gabriel2Silva commented 1 month ago

Description

CRT SwitchRes is broken in 1.18.0-2. In short, enabling CRT SwitchRes will always result in *** buffer overflow detected ***: terminated zsh: IOT instruction (core dumped). RetroArch crashes and closes immediately.

Full log: [INFO] [Config]: Looking for config in: "/home/gabriel/.config/retroarch/retroarch.cfg". [INFO] RetroArch 1.18.0 (Git 06fa5325f8) [INFO] === Build ======================================= [INFO] CPU Model Name: 13th Gen Intel(R) Core(TM) i7-13700K [INFO] Capabilities: MMX MMXEXT SSE SSE2 SSE3 SSSE3 SSE4 SSE42 AES AVX AVX2 [INFO] Version: 1.18.0 [INFO] Git: 06fa5325f8 [INFO] Built: May 5 2024 [INFO] ================================================= [INFO] [Input]: Found input driver: "udev". [INFO] [Environ]: SET_PIXEL_FORMAT: RGB565. [INFO] [Core]: Version of libretro API: 1, Compiled against API: 1 [INFO] [Core]: Geometry: 320x240, Aspect: 1.333, FPS: 60.00, Sample rate: 48000.00 Hz. [INFO] [Audio]: Set audio input rate to: 48000.00 Hz. [INFO] [Video]: Set video size to: fullscreen. [ERROR] [Wayland]: Failed to connect to Wayland server. [INFO] [Vulkan]: Vulkan dynamic library loaded. [INFO] [Vulkan]: Found vulkan context: "vk_x". [INFO] [Vulkan]: Detecting screen resolution: 1024x768. [INFO] [XINERAMA]: Xinerama version: 1.1. [INFO] [XINERAMA]: Xinerama screens: 1. [INFO] [X/Vulkan]: Using Xinerama on screen #0. [INFO] [X/Vulkan]: X = 0, Y = 0, W = 1024, H = 768. [INFO] [X/Vulkan]: Requesting compositor bypass. [INFO] [X/Vulkan]: Using windowed fullscreen. [INFO] [Vulkan]: Found GPU at index 0: "NVIDIA GeForce GTX 1660 SUPER". [INFO] [Vulkan]: Found GPU at index 1: "Intel(R) Graphics (RPL-S)". [INFO] [Vulkan]: Using GPU index 0. [INFO] [Vulkan]: Using fences for WSI acquire. [INFO] [Vulkan]: Using GPU: "NVIDIA GeForce GTX 1660 SUPER". [INFO] [Vulkan]: Queue family 0 supports 16 sub-queues. [INFO] [Vulkan]: Got 2 swapchain images. [INFO] [Vulkan]: Got 2 swapchain images. [INFO] [Vulkan]: Using resolution 1024x768. [INFO] [Vulkan]: Using RGB565 format. [INFO] [Vulkan]: Loading stock shader. [INFO] [udev]: Keyboard #0: "Power Button" (/dev/input/event2). [INFO] [udev]: Keyboard #1: "Video Bus" (/dev/input/event3). [INFO] [udev]: Keyboard #2: "Power Button" (/dev/input/event1). [INFO] [udev]: Keyboard #3: "Sleep Button" (/dev/input/event0). [INFO] [udev]: Keyboard #4: "Zhuhai Hoksi Technology CO.LTD Durgod Mechanical Keyboard" (/dev/input/event24). [INFO] [udev]: Keyboard #5: "Zhuhai Hoksi Technology CO.LTD Durgod Mechanical Keyboard System Control" (/dev/input/event25). [INFO] [udev]: Keyboard #6: "Zhuhai Hoksi Technology CO.LTD Durgod Mechanical Keyboard Consumer Control" (/dev/input/event26). [INFO] [udev]: Keyboard #7: "Zhuhai Hoksi Technology CO.LTD Durgod Mechanical Keyboard" (/dev/input/event27). [INFO] [udev]: Keyboard #8: "Compx KYSONA M600" (/dev/input/event17). [INFO] [udev]: Keyboard #9: "Compx KYSONA M600 Consumer Control" (/dev/input/event20). [INFO] [udev]: Keyboard #10: "Compx KYSONA M600 System Control" (/dev/input/event21). [INFO] [udev]: Keyboard #11: "Intel HID events" (/dev/input/event5). [INFO] [udev]: Mouse/Touch #0: "Compx KYSONA M600" (REL) /dev/input/event23. [INFO] [udev]: Pad #0 (/dev/input/event4) supports 0 force feedback effects. [INFO] [Autoconf]: raphnet technologies PSX to USB v1.0 configured in port 1. [INFO] [udev]: Pad #1 (/dev/input/event15) supports 0 force feedback effects. [INFO] [Autoconf]: Matheus Fraguas RetroZord configured in port 2. [INFO] [udev]: Pad #2 (/dev/input/event16) supports 0 force feedback effects. [INFO] [Autoconf]: Matheus Fraguas RetroZord configured in port 3. [INFO] [Joypad]: Found joypad driver: "udev". [INFO] [DBus]: Suspended screensaver via DBus. [INFO] [Video]: Found display server: "x11". [INFO] [ALSA]: Using ALSA version 1.2.11 [INFO] [ALSA]: Using FLOAT_LE sample format for PLAYBACK device "alsa_playback.retroarch" [INFO] [ALSA]: Period: 4 periods per buffer (384 frames, 3072 bytes) [INFO] [ALSA]: Buffer size: 1536 frames (12288 bytes) [INFO] [ALSA]: Can pause: yes. [INFO] [ALSA]: Initialized PLAYBACK device "alsa_playback.retroarch" [INFO] [Audio]: Started synchronous audio driver. [INFO] [Display]: Found display driver: "vulkan". [INFO] [Playlist]: Loading history file: "/home/gabriel/.config/retroarch/content_history.lpl". [INFO] [Playlist]: Loading history file: "/home/gabriel/.config/retroarch/content_music_history.lpl". [INFO] [Playlist]: Loading history file: "/home/gabriel/.config/retroarch/content_video_history.lpl". [INFO] [Playlist]: Loading history file: "/home/gabriel/.config/retroarch/content_image_history.lpl". [INFO] [Playlist]: Loading favorites file: "/home/gabriel/.config/retroarch/content_favorites.lpl". [INFO] [X/Vulkan]: Resized fullscreen resolution to 1024x768. [INFO] [CRT]: Requested Resolution: 320x240@60.000000 orientation: normal [INFO] [CRT] Video context is: vk_x *** buffer overflow detected ***: terminated zsh: IOT instruction (core dumped)

Expected behavior

CRT SwitchRes should work properly (RetroArch should be capable of on-the-fly resolution switching), as it worked fine in 1.18.0-1.

Actual behavior

Everytime CRT SwitchRes is enabled, RetroArch crashes.

Steps to reproduce the bug

  1. Open RetroArch
  2. Enable CRT SwitchRes (Settings > Video > CRT SwitchRes > CRT SwitchRes > choose any option)

Bisect Results

This issue was introduced in 1.18.0-2. Downgrading to 1.18.0-1 fixes the issue completely and CRT SwitchRes works as intended.

Version/Commit

RetroArch Version: 1.18.0 Git version: 06fa5325f8 Build date: May 5 2024

Environment information

gouchi commented 1 month ago

Hi,

Can you provide some debug log following this documentation ? At least with

git clone  https://github.com/libretro/RetroArch.git
cd RetroArch
./configure && make DEBUG=1  -j$(nproc)
gdb ./retroarch

Then enter r to launch RA then bt full when you get the crash.

Thank you.

Gabriel2Silva commented 1 month ago

Hi,

Can you provide some debug log following this documentation ? At least with

git clone  https://github.com/libretro/RetroArch.git
cd RetroArch
./configure && make DEBUG=1  -j$(nproc)
gdb ./retroarch

Then enter r to launch RA then bt full when you get the crash.

Thank you.

Thanks for the instructions.

I'm not very experienced with any of this, but I did exactly what you told me to do and CRT SwitchRes works perfectly fine. Although by using git clone https://github.com/libretro/RetroArch.git, it pulls and runs a different commit version, c1a2e21447 (which is probably more up-to-date?). My issue happens in commit version 06fa5325f8, which is the latest and most up-to-date RetroArch version available in Manjaro Linux extra repository. In fact, I blacklisted the retroarch package in my /etc/pacman.conf IgnorePkg because if it ever updates to the latest version in the extra repository (1.18.0-2), it breaks.

Am I wrong, or is it safe to say it was already fixed?

gouchi commented 1 month ago

Hi,

Yes, if it is working with the latest from git, it means indeed it should have been fixed.

So for now, you will have to use your own version or wait the next update for the Manjaro package.

Gabriel2Silva commented 1 week ago

Hello.

Recently, RetroArch was updated to 1.19.1 (Git 0792144fe3) on Manjaro Linux. It went from 1.18.0-2 to 1.19.1. I've updated it through pacman, only to find out this issue still isn't fixed. The exact same issue happens:

[INFO] [Config]: Looking for config in: "/home/gabriel/.config/retroarch/retroarch.cfg".
[INFO] RetroArch 1.19.1 (Git 0792144fe3)
[INFO] === Build =======================================
[INFO] CPU Model Name: 13th Gen Intel(R) Core(TM) i7-13700K
[INFO] Capabilities: MMX MMXEXT SSE SSE2 SSE3 SSSE3 SSE4 SSE42 AES AVX AVX2 
[INFO] Version: 1.19.1
[INFO] Git: 0792144fe3
[INFO] Built: Jun 16 2024
[INFO] =================================================
[INFO] [Input]: Found input driver: "x".
[ERROR] Couldn't find any cloud sync driver named ""
[INFO] Available cloud sync drivers are:
[INFO]  webdav
[INFO]  null
[WARN] Going to default to first cloud sync driver...
[INFO] [Environ]: SET_PIXEL_FORMAT: RGB565.
[INFO] [Core]: Version of libretro API: 1, Compiled against API: 1
[INFO] [Core]: Geometry: 320x240, Aspect: 1.333, FPS: 60.00, Sample rate: 48000.00 Hz.
[INFO] [Audio]: Set audio input rate to: 48000.00 Hz.
[INFO] [Video]: Set video size to: 960x720.
[ERROR] [Wayland]: Failed to connect to Wayland server.
[INFO] [GLX]: GLX_EXT_swap_control_tear supported.
[INFO] [GLCore]: Found GL context: "x".
[INFO] [GLCore]: Detecting screen resolution: 1024x768.
[INFO] [GLX]: X = 0, Y = 0, W = 960, H = 720.
[INFO] [GLX]: Creating context for requested version 3.2.
[INFO] [GLX]: Not running Mesa, trying higher versions...
[INFO] [GLX]: Creating context for version 4.6.
[INFO] [GLX]: Found swap function: glXSwapIntervalEXT.
[INFO] [GLCore]: Vendor: NVIDIA Corporation, Renderer: NVIDIA GeForce GTX 1660 SUPER/PCIe/SSE2.
[INFO] [GLCore]: Version: 4.6.0 NVIDIA 550.90.07.
[INFO] [GLCore]: Using resolution 960x720.
[INFO] [udev]: Pad #0 (/dev/input/event4) supports 0 force feedback effects.
[INFO] [Autoconf]: raphnet technologies PSX to USB v1.0 configured in port 1.
[INFO] [Joypad]: Found joypad driver: "udev".
[INFO] [GLCore]: Loading stock shader.
[INFO] [slang]: Building pass #0 (N/A)
[INFO] [GLCore]: Not using frame history.
[INFO] [GLCore]: Not using framebuffer feedback.
[INFO] [DBus]: Suspended screensaver via DBus.
[INFO] [Video]: Found display server: "x11".
[INFO] [PulseAudio]: Requested 24576 bytes buffer, got 18432.
[INFO] [Audio]: Started synchronous audio driver.
[INFO] [ALSA] Using ALSA version 1.2.12
[INFO] [Microphone]: Initialized microphone driver.
[INFO] [Display]: Found display driver: "glcore".
[INFO] [Playlist]: Loading history file: "/home/gabriel/.config/retroarch/content_history.lpl".
[INFO] [Playlist]: Loading history file: "/home/gabriel/.config/retroarch/content_music_history.lpl".
[INFO] [Playlist]: Loading history file: "/home/gabriel/.config/retroarch/content_video_history.lpl".
[INFO] [Playlist]: Loading history file: "/home/gabriel/.config/retroarch/content_image_history.lpl".
[INFO] [Playlist]: Loading favorites file: "/home/gabriel/.config/retroarch/content_favorites.lpl".
[INFO] [PulseAudio]: Pausing.
[INFO] [CRT]: Requested Resolution: 320x240@60.000000 orientation: normal
[INFO] [CRT] Video context is: x
*** buffer overflow detected ***: terminated
zsh: IOT instruction (core dumped)  retroarch --verbose

Basically, it renders CRT SwitchRes unusable regardless of video driver or settings.

I also tried doing what gouchi suggested earlier:

git clone  https://github.com/libretro/RetroArch.git
cd RetroArch
./configure && make DEBUG=1  -j$(nproc)
gdb ./retroarch

After entering r, RetroArch runs normally, and after enabling CRT SwitchRes in the Video menu, it works as intended.

I already tried uninstalling RetroArch completely through pacman, and I also tried deleting all of my config files, including retroarch.cfg. The moment I enable CRT SwitchRes, it crashes with a buffer overflow error.