Opened 4 months ago

Closed 26 hours ago

#15251 closed defect (fixed)

GRAPHICS: Segfault when building with --disable-16bit

Reported by: scummvmuser Owned by: Le Philousophe <lephilousophe@…>
Priority: high Component: Graphics
Version: Keywords:
Cc: Game:

Description

ScummVM segfaults immediately if I configure --disable-16bit.
Feel free to close this with "well don't do that then". (But I guess this should be handled somehow instead of segfault.)

Bisect:

$ git bisect bad

bcc92593825aba9e3e8e87cf615168ab016dcb54 is the first bad commit
Date:   Thu Aug 24 21:55:21 2023 +0100

    BACKENDS: Report if the backend supports cursors with alpha channels

 backends/graphics/opengl/opengl-graphics.cpp       |  1 +
 .../graphics/surfacesdl/surfacesdl-graphics.cpp    |  7 +--
 backends/graphics3d/android/android-graphics3d.cpp |  1 +
 backends/graphics3d/ios/ios-graphics3d.cpp         |  1 +
 backends/platform/3ds/osystem-graphics.cpp         |  1 +
 backends/platform/dc/dcmain.cpp                    |  1 +
 backends/platform/ds/ds-graphics.cpp               |  2 +-
 backends/platform/ios7/ios7_osys_main.cpp          |  1 +
 .../platform/libretro/src/libretro-os-base.cpp     |  2 +-
 backends/platform/psp/osys_psp.cpp                 |  2 +-
 backends/platform/wii/osystem.cpp                  |  1 +
 common/system.h                                    |  6 +++
 graphics/cursorman.cpp                             |  8 ----
 gui/ThemeEngine.cpp                                | 52 +++++++++++-----------
 gui/ThemeEngine.h                                  |  3 +-
 15 files changed, 45 insertions(+), 44 deletions(-)

Configure, build, run:
./configure --disable-all-engines --disable-detection-full --enable-debug --enable-asan --disable-16bit && make -j"$(nproc)" && ASAN_OPTIONS=alloc_dealloc_mismatch=0 ./scummvm -d11

Log:

Debuglevel (from command line): 11
Using SDL Video Driver "x11"
Invalid joystick: 0
Using SDL Audio Driver "pulseaudio"
Output sample rate: 44100 Hz
Output buffer size: 1024 samples
Output channels: 2
OpenGL: GL context initialized
OpenGL version: 4.6.0 NVIDIA 535.183.01
OpenGL vendor: NVIDIA Corporation
OpenGL renderer: NVIDIA GeForce GTX 980 Ti/PCIe/SSE2
OpenGL: version 4.6
OpenGL: GLSL version string: 4.60 NVIDIA
OpenGL: GLSL version: 460
OpenGL: Max texture size: 16384
OpenGL: NPOT texture support: 1
OpenGL: Shader support: 1
OpenGL: Shader support for engines: 1
OpenGL: Multitexture support: 1
OpenGL: FBO support: 1
OpenGL: Multisample FBO support: 1
OpenGL: Multisample max number: 32
OpenGL: Packed pixels support: 1
OpenGL: Packed depth stencil support: 1
OpenGL: Unpack subimage support: 1
OpenGL: OpenGL ES depth 24 support: 0
OpenGL: Texture edge clamping support: 1
OpenGL: Texture border clamping support: 1
OpenGL: Texture mirror repeat support: 1
OpenGL: Texture max level support: 1
generateZipSet: Loaded pack file: shaders.dat
HardwareInput with ID 'JOY_START' not known
HardwareInput with ID 'JOY_LEFT_STICK_Y-' not known
HardwareInput with ID 'JOY_LEFT_STICK_Y+' not known
HardwareInput with ID 'JOY_LEFT_STICK_X-' not known
HardwareInput with ID 'JOY_LEFT_STICK_X+' not known
HardwareInput with ID 'JOY_RIGHT_SHOULDER' not known
CPU extensions:
SSE2(enabled) AVX2(enabled) NEON(not supported)
Reported DPI: 117.797 default: 90, ratio 1.30886, clipped: 1.30886
Setting 1280 x 1377 -> 977 x 1052 -- 1.30886
generateZipSet: Loaded pack file: gui-icons.dat
Opening hashed: THEMERC
Opening hashed: THEMERC
Opening hashed: THEMERC
Opening hashed: THEMERC
Loading theme gui/themes/scummremastered.zip
Opening hashed: THEMERC
Finished loading theme gui/themes/scummremastered.zip
WARNING: initWithU32String: Fribidi not available, will use input strings as fallback.!
Adding Gui Object 0x619000040b80 to trash
Adding Gui Object 0x61900003a780 to trash
Adding Gui Object 0x61900003ac80 to trash
HardwareInput with ID 'JOY_A' not known
HardwareInput with ID 'JOY_Y' not known
HardwareInput with ID 'JOY_UP' not known
HardwareInput with ID 'JOY_DOWN' not known
HardwareInput with ID 'JOY_LEFT' not known
HardwareInput with ID 'JOY_RIGHT' not known
AddressSanitizer:DEADLYSIGNAL
=================================================================
==45685==ERROR: AddressSanitizer: SEGV on unknown address 0x61a0ffff2f8c (pc 0x556a5026d384 bp 0x7ffe28453180 sp 0x7ffe28453170 T0)
==45685==The signal is caused by a WRITE memory access.
    #0 0x556a5026d384 in OpenGL::TextureCLUT8GPU::setColorKey(unsigned int) (/home/user/scummvm/scummvm+0x4f3384)
    #1 0x556a5026090c in OpenGL::OpenGLGraphicsManager::updateCursorPalette() (/home/user/scummvm/scummvm+0x4e690c)
    #2 0x556a5025a54b in OpenGL::OpenGLGraphicsManager::setMouseCursor(void const*, unsigned int, unsigned int, int, int, unsigned int, bool, Graphics::PixelFormat const*, unsigned char const*) (/home/user/scummvm/scummvm+0x4e054b)
    #3 0x556a501b88f7 in ModularGraphicsBackend::setMouseCursor(void const*, unsigned int, unsigned int, int, int, unsigned int, bool, Graphics::PixelFormat const*, unsigned char const*) (/home/user/scummvm/scummvm+0x43e8f7)
    #4 0x556a5033e9c7 in Graphics::CursorManager::pushCursor(Graphics::Surface const&, int, int, unsigned int, bool, unsigned char const*) (/home/user/scummvm/scummvm+0x5c49c7)
    #5 0x556a5033e5d9 in Graphics::CursorManager::pushCursor(void const*, unsigned int, unsigned int, int, int, unsigned int, bool, Graphics::PixelFormat const*, unsigned char const*) (/home/user/scummvm/scummvm+0x5c45d9)
    #6 0x556a500e9c24 in GUI::ThemeEngine::showCursor() (/home/user/scummvm/scummvm+0x36fc24)
    #7 0x556a500d6b8c in GUI::ThemeEngine::enable() (/home/user/scummvm/scummvm+0x35cb8c)
    #8 0x556a50023c5c in GUI::GuiManager::runLoop() (/home/user/scummvm/scummvm+0x2a9c5c)
    #9 0x556a5003126e in GUI::LauncherDialog::run() (/home/user/scummvm/scummvm+0x2b726e)
    #10 0x556a5003a493 in GUI::LauncherChooser::runModal() (/home/user/scummvm/scummvm+0x2c0493)
    #11 0x556a4ff478f1 in launcherDialog() (/home/user/scummvm/scummvm+0x1cd8f1)
    #12 0x556a4ff4f378 in scummvm_main (/home/user/scummvm/scummvm+0x1d5378)
    #13 0x556a4ff437a3 in main (/home/user/scummvm/scummvm+0x1c97a3)
    #14 0x7f0279a46249 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
    #15 0x7f0279a46304 in __libc_start_main_impl ../csu/libc-start.c:360
    #16 0x556a4ff332a0 in _start (/home/user/scummvm/scummvm+0x1b92a0)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (/home/user/scummvm/scummvm+0x4f3384) in OpenGL::TextureCLUT8GPU::setColorKey(unsigned int)
==45685==ABORTING

Change History (3)

comment:1 by tag2015, 11 days ago

Summary: Segfault with disable-16bitGRAPHICS: Segfault when building with --disable-16bit

comment:2 by tag2015, 37 hours ago

Priority: normalhigh

comment:3 by Le Philousophe <lephilousophe@…>, 26 hours ago

Owner: set to Le Philousophe <lephilousophe@…>
Resolution: fixed
Status: newclosed

In 107b60a:

BACKENDS: OPENGL: Fix segfault when compiled without RGB color

The cursor is not impacted by this option, only the game screen.
This fixes bug 15251.

Note: See TracTickets for help on using tickets.