Project

General

Profile

Actions

Emulator Issues #9233

closed

Compiling outside a git tree

Added by jcowgill almost 9 years ago. Updated over 8 years ago.

Status:
Fixed
Priority:
Normal
Assignee:
% Done:

0%

Operating system:
N/A
Issue type:
Bug
Milestone:
Current
Regression:
Yes
Relates to usability:
No
Relates to performance:
No
Easy:
Yes
Relates to maintainability:
No
Regression start:
Fixed in:

Description

If Dolphin is compiled either without git installed or from a non-git source tree (eg downloaded through a link on GitHub), subtle errors occur due to the use of scm_rev_git_str. Without git scm_rev_git_str expands to an empty string whereas certain uses assume it to be a string with exactly 40 chars.

For example, compiling without git and with asan enabled immediately causes dolphin to crash on startup with:

==15199==ERROR: AddressSanitizer: global-buffer-overflow on address 0x00000188d4a1 at pc 0x7f5282980445 bp 0x7ffd69eaeb00 sp 0x7ffd69eae2b0
READ of size 40 at 0x00000188d4a1 thread T0
    #0 0x7f5282980444 in __asan_memcpy (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x88444)
    #1 0xf0b74e in LinearDiskCache<OGL::SHADERUID, unsigned char>::Header::Header() /tmp/dol/Source/Core/Common/LinearDiskCache.h:189
    #2 0xf09e1e in LinearDiskCache<OGL::SHADERUID, unsigned char>::LinearDiskCache() (/tmp/dol/build/Binaries/dolphin-emu-nogui+0xf09e1e)
    #3 0xf08079 in __static_initialization_and_destruction_0 /tmp/dol/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp:35
    #4 0xf0818f in _GLOBAL__sub_I__ZN3OGL18ProgramShaderCache17s_ubo_buffer_sizeE /tmp/dol/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp:644
    #5 0x117d5ac in __libc_csu_init (/tmp/dol/build/Binaries/dolphin-emu-nogui+0x117d5ac)
    #6 0x7f527b95c7fe in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x207fe)
    #7 0x51c2d8 in _start (/tmp/dol/build/Binaries/dolphin-emu-nogui+0x51c2d8)

0x00000188d4a1 is located 0 bytes to the right of global variable '*.LC2' defined in '/tmp/dol/Source/Core/Common/Version.cpp' (0x188d4a0) of size 1
  '*.LC2' is ascii string ''
SUMMARY: AddressSanitizer: global-buffer-overflow ??:0 __asan_memcpy

Originally noticed after this PR:
https://github.com/dolphin-emu/dolphin/pull/3467
If I've read it right, the netplay version will always be the empty string for anyone compiling dolphin without git.

Either building dolphin within a git tree (and with git installed) need to be enforced, or each occurrence of scm_rev_git_str (and possibly other scm_ variables) needs to be fixed to work when they're empty.

Actions

Also available in: Atom PDF