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 in parse_overlay_env when passing graphs option via MANGOHUD_CONFIG #997

Closed
moody-pantomime opened this issue Apr 16, 2023 · 5 comments

Comments

@moody-pantomime
Copy link

Describe the bug
Passing graphs options via MANGOHUD_CONFIG environment variable causes segfault.

This seems to happen because parse_overlay_env is called inside parse_overlay_config before the HUDElements.params field is set.

Inside parse_overlay_env, HUDElements.sort_elements is called, where the graphs option has a special case in which HUDElements.params is being accessed. But the field is still nullptr, thus the segfault.

List relevant hardware/software information

  • Void
  • v0.6.9
  • AMD RX6800

To Reproduce
Built MangoHud locally with buildtype=debug, but segfault also happens with release version from Void's repos.

MANGOHUD_CONFIG='graphs=vram' /usr/local/bin/mangohud vkcube
zsh: segmentation fault  MANGOHUD_CONFIG='graphs=vram' /usr/local/bin/mangohud vkcube

Expected behavior
No segfault.

Screenshots
None.

Additional context
None.

@flightlessmango
Copy link
Owner

Can you post a gdb backtrace of the segfault please?

@moody-pantomime
Copy link
Author

Ran with MANGOHUD_CONFIG='graphs=vram' /usr/local/bin/mangohud gdb vkcube

Thread 1 "vkcube" received signal SIGSEGV, Segmentation fault.
HudElements::sort_elements (this=0x7fffeeb5a1e0 <HUDElements>, option={...}) at ../src/hud_elements.cpp:1163
1163	        if (!HUDElements.params->enabled[OVERLAY_PARAM_ENABLED_graphs])
(gdb) bt
#0  HudElements::sort_elements (this=0x7fffeeb5a1e0 <HUDElements>, option={...}) at ../src/hud_elements.cpp:1163
#1  0x00007fffee841a5f in parse_overlay_env (params=0x5555557c8720, env=0x7fffffffe855 "") at ../src/overlay_params.cpp:531
#2  0x00007fffee845c95 in parse_overlay_config (params=0x5555557c8720, env=0x7fffffffe84a "graphs=vram") at ../src/overlay_params.cpp:690
#3  0x00007fffee86f7f1 in overlay_CreateInstance (pCreateInfo=0x7fffffffcc90, pAllocator=0x0, pInstance=0x7fffffffcd48) at ../src/vulkan.cpp:1899
#4  0x00007ffff7adc8bc in ?? () from /usr/lib/libvulkan.so.1
#5  0x00007ffff7ae2c61 in vkCreateInstance () from /usr/lib/libvulkan.so.1
#6  0x0000555555557f01 in ?? ()
#7  0x00007ffff78e320c in __libc_start_call_main (main=main@entry=0x555555557750, argc=argc@entry=1, argv=argv@entry=0x7fffffffe208) at ../sysdeps/nptl/libc_start_call_main.h:58
#8  0x00007ffff78e32bc in __libc_start_main_impl (main=0x555555557750, argc=1, argv=0x7fffffffe208, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffe1f8) at ../csu/libc-start.c:381
#9  0x000055555555a4da in ?? ()
(gdb) print HUDElements.params
$1 = (overlay_params *) 0x0

@shmerl
Copy link

shmerl commented Apr 16, 2023

I also experienced the segfault.

A side question, why aren't graph options documented in the readme? I couldn't find details on it, except in one of the old release notes.

@flightlessmango
Copy link
Owner

This shouldn't segfault anymore since 7f94562

why aren't graph options documented in the readme?

Because no one has taken the time to do it

@moody-pantomime
Copy link
Author

Works for me now. Thanks!

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

3 participants