Menu

#4 Consistent exception trying to decode specific MAP file

0.0.19a
closed
Bug (2)
2022-02-11
2019-07-25
No

Working on the SWY's CivOne project. The attached is a generated .MAP file from that code. I consistently get an EOF exception when trying to load this file (LittleEndianDataInputStream, readUnsignedByte()). Other .MAP files from CivOne have no similar problems.

CivOne decodes it without complaint, and Microprose CivDOS appears to as well.

I don't yet understand the PIC format well enough to know if this is a bug in the CivOne code or jCivEd. Any input to fix this would be appreciated - jCivEd is a very useful tool and it is frustrating to not be able to use it with certain CivOne games.

1 Attachments

Discussion

  • darkpandaman

    darkpandaman - 2019-07-27
    • labels: --> Bug
    • assigned_to: darkpandaman
     
  • darkpandaman

    darkpandaman - 2019-07-27

    Thanks for reporting, I will try to have a look at it as soon as possible.

    Maybe an opportunity to write unit tests for this part too.

     
  • darkpandaman

    darkpandaman - 2019-07-30

    Apparently a conditional read is not correctly checking that it has enough bytes to consum, at line 102 in LZWDecoder:

    https://sourceforge.net/p/jcived/code/HEAD/tree/branches/dev-commons/src/dd/commons/graphics/pic/compression/LZWDecoder.java

    By modifying the condition to the below, it seems to fix the problem (very little testing):

    Before:

                while(usableBitCount<8+indicatorLength) {
    

    After:

                while(remainingCodedBytes>0 && usableBitCount<8+indicatorLength) {
    
     
  • darkpandaman

    darkpandaman - 2019-07-30
    • status: open --> accepted
     
  • Kevin Routley

    Kevin Routley - 2019-07-30

    Excellent! Certainly seems to work, at least for that .MAP file! Much appreciated!

    Trying to move forward with CivOne, your disassembly code and other articles in CivFanatics have proven to be indispensible [not to mention jCivEd!]! My thanks for your efforts!

     
  • darkpandaman

    darkpandaman - 2022-02-03

    Fixed in 0.0.19a

     
  • darkpandaman

    darkpandaman - 2022-02-11
    • status: accepted --> closed
     

Log in to post a comment.