libiff icon indicating copy to clipboard operation
libiff copied to clipboard

cant decode file created with an amiga program (source for pr0ggie included)

Open ghost opened this issue 9 years ago • 3 comments

https://github.com/paigeadele/derp/raw/master/amiga.iff

if you want to play around and try to figure out why... https://github.com/paigeadele/derp/tree/master/screenshotutil

Error:

laptop erratic # /usr/local/bin/ilbm2acbm -i amiga.iff -o amiga.acbm
WARNING: Trailing IFF contents found: 66!
Chunk size mismatch! FORM size: -2147483647, while body has: 4
Invalid ILBM file!
laptop erratic # exit

ghost avatar Mar 25 '15 09:03 ghost

amiga.iff  /usr/local/bin/iffpp
laptop derp # /usr/local/bin/iffpp amiga.iff 
WARNING: Trailing IFF contents found: 66!
Chunk size mismatch! FORM size: -2147483647, while body has: 4
laptop derp # 

ghost avatar Mar 25 '15 09:03 ghost

If you figure out why I'd be curious to hear about it I can only imagine it must be something brilliant

ghost avatar Mar 25 '15 09:03 ghost

Hi,

If you run iffpp with the -c parameter (which disables validity checking) you will see the following output:

$ iffpp amiga.iff -c WARNING: Trailing IFF contents found: 66! 'FORM' = { chunkSize = -2147483647; formType = 'ILBM'; [ ]; }

As you may probably notice, there is something wrong with the FORM chunk size, because it's a negative value. I inspected the file with a hex editor and noticed that this value is congruent with what is actually inside the IFF file, so it's not caused by the parser library. The form chunk size should correspond to the cumulative size of all chunks stored inside it with padding bytes included. In this file this is not the case, so that's why it gets confused.

I think some Amiga programs might be able to open this file, because they probably ignore the FORM chunk size (or the FORM chunk entirely) and only look for the data chunks that it understands.

So technically the file is incorrect. To be able to open the file with libilbm or libiff, the chunk size in this file must be fixed or I must implement something that copes with these kind of errors :-)

On Wed, Mar 25, 2015 at 10:11 AM, Paige Thompson [email protected] wrote:

If you figure out why I'd be curious to hear about it I can only imagine it must be something brilliant

— Reply to this email directly or view it on GitHub https://github.com/svanderburg/libiff/issues/3#issuecomment-85944133.

svanderburg avatar Mar 26 '15 19:03 svanderburg