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
4134f06358
commit
061a176595
1
CHANGES
1
CHANGES
|
@ -10,6 +10,7 @@ Other fixes:
|
|||
- CMake: Link with correct OpenGL library (fixes mgba.io/i/1872)
|
||||
- Core: Fix threading improperly setting paused state while interrupted
|
||||
- Core: Fix thread unsafety issue when dispatching code to a thread
|
||||
- Core: Fix loading ELF files that have unexpected empty program headers
|
||||
- Debugger: Close trace log when done tracing
|
||||
- Qt: Fix running proxied video if it gets pushed to the main thread
|
||||
- Qt: Fix game display sometimes disappearing after closing load/save state screen
|
||||
|
|
|
@ -371,6 +371,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 = mCoreGetMemoryBlock(core, phdr->p_paddr, &bsize);
|
||||
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