mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-26 19:58:36 +01:00
Add a safety check for lots of segments.
This commit is contained in:
1 parent
4ced0e86b1
commit
bddeba5901
1 file changed
+5
-3
@@ -948,8 +948,10 @@ Module *__KernelLoadELFFromPtr(const u8 *ptr, u32 loadAddress, std::string *erro
|
||||
module->nm.data_size = 0;
|
||||
// TODO: Is summing them up correct? Must not be since the numbers aren't exactly right.
|
||||
for (int i = 0; i < reader.GetNumSegments(); ++i) {
|
||||
module->nm.segmentaddr[i] = reader.GetSegmentVaddr(i);
|
||||
module->nm.segmentsize[i] = reader.GetSegmentMemSize(i);
|
||||
if (i < (int)ARRAY_SIZE(module->nm.segmentaddr)) {
|
||||
module->nm.segmentaddr[i] = reader.GetSegmentVaddr(i);
|
||||
module->nm.segmentsize[i] = reader.GetSegmentMemSize(i);
|
||||
}
|
||||
module->nm.data_size += reader.GetSegmentDataSize(i);
|
||||
}
|
||||
module->nm.gp_value = modinfo->gp;
|
||||
@@ -968,7 +970,7 @@ Module *__KernelLoadELFFromPtr(const u8 *ptr, u32 loadAddress, std::string *erro
|
||||
}
|
||||
}
|
||||
|
||||
if (!module->isFake && module->memoryBlockAddr != 0) {
|
||||
if (!module->isFake && module->memoryBlockAddr != 0) {
|
||||
symbolMap.AddModule(moduleName, module->memoryBlockAddr, module->memoryBlockSize);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user