Global: Cleanup initialization/pointer checks.

Cleaning up a lot of cases of uninitialized data, unchecked return values
for failures, and similar.
This commit is contained in:
Unknown W. Brackets committed 2022-12-10 21:13:36 -08:00
1 parent a7b7bf7826
commit 9cfcbc46e6
41 files changed
+190 -138

No files matched your search

+3 -3
View File
@@ -128,7 +128,7 @@ bool ElfReader::LoadRelocations(const Elf32_Rel *rels, int numRelocs) {
if (log) {
DEBUG_LOG(LOADER, "rel at: %08x info: %08x type: %i", addr, info, type);
}
u32 relocateTo = segmentVAddr[relative];
u32 relocateTo = relative >= (int)ARRAY_SIZE(segmentVAddr) ? 0 : segmentVAddr[relative];
switch (type) {
case R_MIPS_32:
@@ -289,9 +289,9 @@ void ElfReader::LoadRelocations2(int rel_seg)
}
}else{
addr_seg = seg;
relocate_to = segmentVAddr[addr_seg];
relocate_to = addr_seg >= (int)ARRAY_SIZE(segmentVAddr) ? 0 : segmentVAddr[addr_seg];
if (!Memory::IsValidAddress(relocate_to)) {
ERROR_LOG(LOADER, "ELF: Bad address to relocate to: %08x", relocate_to);
ERROR_LOG(LOADER, "ELF: Bad address to relocate to: %08x (segment %d)", relocate_to, addr_seg);
continue;
}