mirror of https://github.com/mgba-emu/mgba.git
Core: Fix loading ELF files that have unexpected empty program headers
This commit is contained in:
parent
6ca62fae83
commit
f7749b31de
1
CHANGES
1
CHANGES
|
@ -56,6 +56,7 @@ Other fixes:
|
|||
- CMake: Link with correct OpenGL library (fixes mgba.io/i/1872)
|
||||
- Core: Ensure ELF regions can be written before trying
|
||||
- Core: Fix threading improperly setting paused state while interrupted
|
||||
- Core: Fix loading ELF files that have unexpected empty program headers
|
||||
- Debugger: Don't skip undefined instructions when debugger attached
|
||||
- Debugger: Close trace log when done tracing
|
||||
- Debugger: Fix change watchpoints (fixes mgba.io/i/1947)
|
||||
|
|
|
@ -382,6 +382,9 @@ bool mCoreLoadELF(struct mCore* core, struct ELF* elf) {
|
|||
for (i = 0; i < ELFProgramHeadersSize(&ph); ++i) {
|
||||
size_t bsize, esize;
|
||||
Elf32_Phdr* phdr = ELFProgramHeadersGetPointer(&ph, i);
|
||||
if (!phdr->p_filesz) {
|
||||
continue;
|
||||
}
|
||||
void* block = mCoreGetMemoryBlockMasked(core, phdr->p_paddr, &bsize, mCORE_MEMORY_WRITE | mCORE_MEMORY_WORM);
|
||||
char* bytes = ELFBytes(elf, &esize);
|
||||
if (block && bsize >= phdr->p_filesz && esize > phdr->p_offset && esize >= phdr->p_filesz + phdr->p_offset) {
|
||||
|
|
Loading…
Reference in New Issue