NationalSecurityAgency / ghidra

Ghidra is a software reverse engineering (SRE) framework
https://www.nsa.gov/ghidra
Apache License 2.0
52.21k stars 5.91k forks source link

AddressOutOfBounds exception in SegmentedAddressSpace.getAddress when importing Old-style DOS executable (MZ) #4318

Closed sad-dev closed 1 year ago

sad-dev commented 2 years ago

Describe the bug I stumbled on this exception while loading a DOS (packed with PKLite) into ghidra

Segment is too large.
ghidra.program.model.address.AddressOutOfBoundsException: Segment is too large.
    at ghidra.program.model.address.SegmentedAddressSpace.getAddress(SegmentedAddressSpace.java:315)
    at ghidra.app.util.opinion.MzLoader.processSegments(MzLoader.java:256)
    at ghidra.app.util.opinion.MzLoader.load(MzLoader.java:108)
    at ghidra.app.util.opinion.AbstractLibrarySupportLoader.doLoad(AbstractLibrarySupportLoader.java:356)
    at ghidra.app.util.opinion.AbstractLibrarySupportLoader.loadProgram(AbstractLibrarySupportLoader.java:84)
    at ghidra.app.util.opinion.AbstractProgramLoader.load(AbstractProgramLoader.java:115)
    at ghidra.plugin.importer.ImporterUtilities.importSingleFile(ImporterUtilities.java:368)
    at ghidra.plugin.importer.ImporterDialog.lambda$okCallback$7(ImporterDialog.java:351)
    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:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:829)

To Reproduce Load GO.exe or NITERAID.exe from the attached zip (also available at https://www.myabandonware.com/game/night-raid-1lf) with the "Old-style DOS Executable (MZ)" loader and "x86:LE:16:Real Mode:default"

Attachments If applicable, please attach any files that caused problems or log files generated by the software.

Night-Raid_DOS_EN_Full-Version.zip

Environment (please complete the following information): Ubuntu 20.04 ghidra master (commit c6cb8a0)

ryanmkurtz commented 1 year ago

Duplicate of #1876