Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when importing SLES_004.68 or SLUS_004.98 from Moto Racer #66

Open
boricj opened this issue Mar 4, 2023 · 1 comment
Open

Crash when importing SLES_004.68 or SLUS_004.98 from Moto Racer #66

boricj opened this issue Mar 4, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@boricj
Copy link
Contributor

boricj commented Mar 4, 2023

When trying to import either SLES_004.68 or SLUS_004.98 from Moto Racer, the import crashes with the following message:

Split cannot be done on block start address
java.lang.IllegalArgumentException: Split cannot be done on block start address
	at ghidra.program.database.mem.MemoryMapDB.split(MemoryMapDB.java:959)
	at psx.PsxLoader.createCompilerSegments(PsxLoader.java:700)
	at psx.PsxLoader.load(PsxLoader.java:313)
	at ghidra.app.util.opinion.AbstractLibrarySupportLoader.doLoad(AbstractLibrarySupportLoader.java:752)
	at ghidra.app.util.opinion.AbstractLibrarySupportLoader.loadProgram(AbstractLibrarySupportLoader.java:100)
	at ghidra.app.util.opinion.AbstractProgramLoader.load(AbstractProgramLoader.java:132)
	at ghidra.plugin.importer.ImporterUtilities.importSingleFile(ImporterUtilities.java:388)
	at ghidra.plugin.importer.ImporterDialog.lambda$okCallback$7(ImporterDialog.java:347)
	at ghidra.util.task.TaskBuilder$TaskBuilderTask.run(TaskBuilder.java:306)
	at ghidra.util.task.Task.monitoredRun(Task.java:134)
	at ghidra.util.task.TaskRunner.lambda$startTaskThread$0(TaskRunner.java:106)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:833)

---------------------------------------------------
Build Date: 2023-Mar-04 1101 CET
Ghidra Version: 10.3
Java Home: /usr/lib/jvm/java-17-openjdk
JVM Version: N/A 17.0.6
OS: Linux 5.15.79.1-microsoft-standard-WSL2 amd64

Looking at Ghidra through a debugger, it appears the plugin is trying to split a memory block at address 0x8001b000, which also starts at 0x8001b000. The method MemoryMapDB.split() checks for that and throws an exception.

Patching out the check for an early return inside MemoryMapDB.split() results in a successful import, so maybe the fix would be to skip calls to MemoryMapDB.split() inside the plugin if the memory block start address and the split address are the same.

@lab313ru lab313ru added the bug Something isn't working label Mar 4, 2023
@lab313ru lab313ru self-assigned this Mar 4, 2023
@lab313ru
Copy link
Owner

lab313ru commented Mar 4, 2023

Thanks. This happens, when my code which looks for segments definition in a game does it incorrectly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants