Skip to content

Instantly share code, notes, and snippets.

View zachhilman's full-sized avatar
🐉
Focusing

Zach Hilman zachhilman

🐉
Focusing
View GitHub Profile
// Undefined or Questionable Behavior Test of IPSwitch
// Written by DarkLordZach (C) 2018
@nsobid-AABBCCDD // Pls don't actually patch something with this
// Goal: break everything
// Patch 1
This file has been truncated, but you can view the full file.
=================================================================
==4968==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 8192 byte(s) in 2 object(s) allocated from:
#0 0x7f414fa95848 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.5+0xee848)
#1 0x7f41316a970b (<unknown module>)
Direct leak of 3976 byte(s) in 1 object(s) allocated from:
#0 0x7f414fa95a50 in calloc (/usr/lib/x86_64-linux-gnu/libasan.so.5+0xeea50)
#1 0x7f4130fd3b7a in vmw_ioctl_init /home/zachhilman/mesa/src/gallium/winsys/svga/drm/vmw_screen_ioctl.c:1022
AddressSanitizer:DEADLYSIGNAL
=================================================================
==4792==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7fbb3644e5e8 bp 0x7fbae4f168c0 sp 0x7fbae4f16028 T7)
==4792==The signal is caused by a WRITE memory access.
==4792==Hint: address points to the zero page.
#0 0x7fbb3644e5e7 (/lib/x86_64-linux-gnu/libc.so.6+0xbb5e7)
#1 0x7fbb396c2eb2 (/usr/lib/x86_64-linux-gnu/libasan.so.5+0x3feb2)
#2 0x55f8f004614f in memcpy /usr/include/x86_64-linux-gnu/bits/string_fortified.h:34
#3 0x55f8f004614f in Memory::ReadBlock(Kernel::Process const&, unsigned long, void*, unsigned long) /home/zachhilman/CLionProjects/yuzu/src/core/memory.cpp:418
#4 0x55f8f057e8ac in RasterizerOpenGL::UploadMemory(unsigned char*, long, unsigned long, unsigned long, unsigned long) /home/zachhilman/CLionProjects/yuzu/src/video_core/renderer_opengl/gl_rasterizer.cpp:417
@zachhilman
zachhilman / tsan2
Created August 12, 2018 22:15
tsan2
This file has been truncated, but you can view the full file.
==================
WARNING: ThreadSanitizer: data race (pid=14219)
Read of size 1 at 0x7b04000098c0 by thread T2:
#0 strlen <null> (libtsan.so.0+0x315c5)
#1 pthread_setname_np <null> (libpthread.so.0+0x1391c)
#2 <null> <null> (libglib-2.0.so.0+0x73ded)
Previous write of size 8 at 0x7b04000098c0 by main thread (mutexes: write M221):
#0 malloc <null> (libtsan.so.0+0x2afa3)
#1 g_malloc <null> (libglib-2.0.so.0+0x51858)
diff --git a/src/core/file_sys/mode.h b/src/core/file_sys/mode.h
index b436315..6d40ad5 100644
--- a/src/core/file_sys/mode.h
+++ b/src/core/file_sys/mode.h
@@ -14,4 +14,6 @@ enum class Mode : u32 {
Append = 4,
};
+constexpr Mode MODE_RW = static_cast<Mode>(3);
+
std::string mode_str;
u32 mode_flags = static_cast<u32>(mode);
// Calculate the correct open mode for the file.
if ((mode_flags & static_cast<u32>(Mode::Read)) &&
(mode_flags & static_cast<u32>(Mode::Write))) {
if (mode_flags & static_cast<u32>(Mode::Append))
mode_str = "a+";
else
mode_str = "r+";

All the random RomFS requests for title ids not in current process.

Cave Story

0000 0000 0000 0000 (x2)

Binding of Isaac

0000 0000 0000 0000 (x2)

Odyssey

None

Function / Call Stack CPU Time Module Function (Full) Source File Start Address
fputs 94.131 ucrtbase.dll fputs [Unknown] 0x180004a00
SetConsoleTextAttribute 90.1951 KERNELBASE.dll SetConsoleTextAttribute [Unknown] 0x1800770a0
GetConsoleScreenBufferInfo 69.6486 KERNELBASE.dll GetConsoleScreenBufferInfo [Unknown] 0x180008870
page_flush_tb_1_aarch64 46.7698 unicorn.dll page_flush_tb_1_aarch64 translate-all.c 0x6b089117
invalidate_page_bitmap_aarch64 23.9179 unicorn.dll invalidate_page_bitmap_aarch64 translate-all.c 0x6b0890d0
[Outside any known module] 21.1967 [Unknown] [Outside any known module] [Unknown] 0
memset 18.1418 msvcrt.dll memset [Unknown] 0x110174600
func@0x69c73ec0 16.9936 nvoglv64.dll func@0x69c73ec0 [Unknown] 0x69c73ec0
tcg_constant_folding_aarch64 16.9699 unicorn.dll tcg_constant_folding_aarch64 optimize.c 0x6b07baa4
diff --git a/src/core/file_sys/vfs.cpp b/src/core/file_sys/vfs.cpp
index 82e8c604..a917fd0b 100644
--- a/src/core/file_sys/vfs.cpp
+++ b/src/core/file_sys/vfs.cpp
@@ -53,7 +53,8 @@ std::shared_ptr<VfsFile> VfsDirectory::GetFileRelative(const filesystem::path& p
return GetFile(path.filename().string());
auto parent = path.parent_path().string();
- parent.replace(path.root_path().string().begin(), path.root_path().string().end(), "");
+ auto root = path.root_path().string();
diff --git a/src/core/file_sys/vfs.cpp b/src/core/file_sys/vfs.cpp
index 82e8c604..a917fd0b 100644
--- a/src/core/file_sys/vfs.cpp
+++ b/src/core/file_sys/vfs.cpp
@@ -53,7 +53,8 @@ std::shared_ptr<VfsFile> VfsDirectory::GetFileRelative(const filesystem::path& p
return GetFile(path.filename().string());
auto parent = path.parent_path().string();
- parent.replace(path.root_path().string().begin(), path.root_path().string().end(), "");
+ auto root = path.root_path().string();