zach-cloud / Frost

Multi-platform MPQ editor
Apache License 2.0
2 stars 0 forks source link

BufferOverflowException #3

Open aicochow opened 3 years ago

aicochow commented 3 years ago

When I save file,I get this error

java.nio.BufferOverflowException
    at java.base/java.nio.HeapByteBuffer.put(HeapByteBuffer.java:221)
    at java.base/java.nio.ByteBuffer.put(ByteBuffer.java:906)
    at model.FileDataEntry.toBytes(FileDataEntry.java:377)
    at model.MpqObject.toBytes(MpqObject.java:287)
    at frost.FrostMpq.toBytes(FrostMpq.java:156)
    at frost.FrostMpq.save(FrostMpq.java:168)
    at cli.CLI.runSave(CLI.java:63)
    at cli.CLI.executeAction(CLI.java:50)
    at cli.CLI.run(CLI.java:33)
    at cli.Launcher.main(Launcher.java:6)
ERROR: Ran out of space for file
exception.MpqException: Ran out of space for file
    at settings.MpqErrorHandler.handleError(MpqErrorHandler.java:19)
    at settings.MpqErrorHandler.handleCriticalError(MpqErrorHandler.java:24)
    at model.FileDataEntry.toBytes(FileDataEntry.java:384)
    at model.MpqObject.toBytes(MpqObject.java:287)
    at frost.FrostMpq.toBytes(FrostMpq.java:156)
    at frost.FrostMpq.save(FrostMpq.java:168)
    at cli.CLI.runSave(CLI.java:63)
    at cli.CLI.executeAction(CLI.java:50)
    at cli.CLI.run(CLI.java:33)
    at cli.Launcher.main(Launcher.java:6)
ERROR: Could not save file: Ran out of space for file
Exception in thread "main" exception.MpqException: Could not save file: Ran out of space for file
    at settings.MpqErrorHandler.handleError(MpqErrorHandler.java:19)
    at settings.MpqErrorHandler.handleCriticalError(MpqErrorHandler.java:24)
    at frost.FrostMpq.save(FrostMpq.java:171)
    at cli.CLI.runSave(CLI.java:63)
    at cli.CLI.executeAction(CLI.java:50)
    at cli.CLI.run(CLI.java:33)
    at cli.Launcher.main(Launcher.java:6)

this is my test file Hero_PushPUB_4.1.w3x.zip

run from source code.I get this error

ava.lang.RuntimeException: Attempted to undo a non-existent operation
        at com.github.zachcloud.reader.BinaryReader.undo(BinaryReader.java:136)
        at com.github.zachcloud.reader.BinaryReader.goTo(BinaryReader.java:118)
        at model.ArchiveHeader.read(ArchiveHeader.java:55)
        at model.MpqObject.read(MpqObject.java:82)
        at frost.FrostMpq.readFile(FrostMpq.java:181)
        at frost.FrostMpq.<init>(FrostMpq.java:112)
        at frost.FrostMpq.<init>(FrostMpq.java:123)
        at frost.FrostMpq.<init>(FrostMpq.java:88)
        at frost.FrostMpq.<init>(FrostMpq.java:99)
        at cli.CLI.run(CLI.java:36)
        at cli.Launcher.main(Launcher.java:11)
ERROR: Failed reading: Attempted to undo a non-existent operation
exception.MpqException: Failed reading: Attempted to undo a non-existent operation
        at settings.MpqErrorHandler.handleError(MpqErrorHandler.java:19)
        at settings.MpqErrorHandler.handleCriticalError(MpqErrorHandler.java:24)
        at model.ArchiveHeader.read(ArchiveHeader.java:85)
        at model.MpqObject.read(MpqObject.java:82)
        at frost.FrostMpq.readFile(FrostMpq.java:181)
        at frost.FrostMpq.<init>(FrostMpq.java:112)
        at frost.FrostMpq.<init>(FrostMpq.java:123)
        at frost.FrostMpq.<init>(FrostMpq.java:88)
        at frost.FrostMpq.<init>(FrostMpq.java:99)
        at cli.CLI.run(CLI.java:36)
        at cli.Launcher.main(Launcher.java:11)
ERROR: Failed to build MPQ file: Failed reading: Attempted to undo a non-existent operation
Exception in thread "main" exception.MpqException: Failed to build MPQ file: Failed reading: Attempted to undo a non-existent operation
        at settings.MpqErrorHandler.handleError(MpqErrorHandler.java:19)
        at settings.MpqErrorHandler.handleCriticalError(MpqErrorHandler.java:24)
        at model.MpqObject.read(MpqObject.java:119)
        at frost.FrostMpq.readFile(FrostMpq.java:181)
        at frost.FrostMpq.<init>(FrostMpq.java:112)
        at frost.FrostMpq.<init>(FrostMpq.java:123)
        at frost.FrostMpq.<init>(FrostMpq.java:88)
        at frost.FrostMpq.<init>(FrostMpq.java:99)
        at cli.CLI.run(CLI.java:36)
        at cli.Launcher.main(Launcher.java:11)
zach-cloud commented 3 years ago

Thanks for the report. I think it might be PG2 protection, which I was never able to find a good way to bypass. I'll take a look.