Merge pull request #19396 from Nemoumbra/small-fixes

Tabulation fix + potential misaligned read fix
This commit is contained in:
Henrik Rydgård 2024-08-12 14:42:03 -06:00 committed by GitHub
commit 80e581a093
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 11 deletions

View File

@ -1219,8 +1219,9 @@ static void parsePrxLibInfo(const u8* ptr, u32 headerSize) {
// The lib info prefix looks like {'\', 'y', 'r', '=', '`', 'c', '`', '0'} (Big Endian)
const u64_le lib_info_prefix = 0x306063603D72795C;
auto lib_info_ptr = reinterpret_cast<const u64_le*>(ptr);
if (*lib_info_ptr != lib_info_prefix) {
// 'ptr' can potentially be misaligned here so let's use a memcmp instead of dereferencing 8 bytes at 'ptr'
if (memcmp(ptr, &lib_info_prefix, 8) != 0) {
// That's very wrong!
WARN_LOG(Log::sceModule, "~SCE module, unexpected header (not an error)");
return;
@ -1236,13 +1237,14 @@ static void parsePrxLibInfo(const u8* ptr, u32 headerSize) {
}
nameBuffer[12] = '\0';
u8 versionBuffer[8] = "?.?.?.?";
u8 versionBuffer[7 + 1] = "?.?.?.?";
for (int i = 0; i < 4; ++i, ++ptr) {
u8 symbol = *ptr - 0x14u;
if (isprint(symbol)) {
versionBuffer[2 * i] = symbol;
}
}
// The null byte is already in its place, no need to assign it manually
INFO_LOG(Log::sceModule, "~SCE module: Lib-PSP %s (SDK %s)", nameBuffer, versionBuffer);
}

View File

@ -61,7 +61,7 @@
#define IDD_GEDBG_TAB_MATRICES 255
#define IDD_GEDBG_STEPCOUNT 256
#define IDD_CPUWATCH 257
#define IDD_EDITSYMBOLS 258
#define IDD_EDITSYMBOLS 258
#define IDC_STOPGO 1001
#define IDC_ADDRESS 1002
@ -123,12 +123,12 @@
#define IDC_SHOWOFFSETS 1200
#define IDC_GEDBG_PRIMCOUNTER 1201
#define IDC_BUTTON_SEARCH 1204
#define IDC_EDITSYMBOLS_SCAN 1205
#define IDC_EDITSYMBOLS_REMOVE 1206
#define IDC_EDITSYMBOLS_ADDRESS 1207
#define IDC_EDITSYMBOLS_SIZE 1208
#define IDC_EDITSYMBOLS_OK 1209
#define IDC_EDITSYMBOLS_CANCEL 1210
#define IDC_EDITSYMBOLS_SCAN 1205
#define IDC_EDITSYMBOLS_REMOVE 1206
#define IDC_EDITSYMBOLS_ADDRESS 1207
#define IDC_EDITSYMBOLS_SIZE 1208
#define IDC_EDITSYMBOLS_OK 1209
#define IDC_EDITSYMBOLS_CANCEL 1210
#define ID_FILE_EXIT 40000
#define ID_DEBUG_SAVEMAPFILE 40001
@ -354,7 +354,7 @@
#define IDC_DISASM_FMT_INT 40233
#define IDC_DISASM_FMT_FLOAT 40234
#define IDC_DISASM_FMT_STR 40235
#define ID_DISASM_EDITSYMBOLS 40236
#define ID_DISASM_EDITSYMBOLS 40236
// Dummy option to let the buffered rendering hotkey cycle through all the options.