corrupted iff file (illegal chunk id)

Geppetto
2011-07-13
2012-11-08
  • Geppetto
    Geppetto
    2011-07-13

    I had a file that displayed correctly but which I could not save. So I went
    down to the code and in IFFByteStream.cpp I made the following changes

    in function:

    int IFFByteStream::check_id(const char *id)
    {
    int i;
    // check absence of null bytes
    for (i=0; i<4; i++)
    if (id_<0x20 || id>0x7e)
    return -2; // instead of -1 that is used also below

    and in function:
    int
    IFFByteStream::get_chunk(GUTF8String &chkid, int *rawoffsetptr, int
    *rawsizeptr)
    {

    // Check if composite
    int composite = check_id(buffer);
    if(composite<-1)return 0; // modification -> means that it is a null chunk
    id, so skip it
    if (composite < 0)
    G_THROW( ERR_MSG("IFFByteStream.corrupt_id") );

    And now, the file can be saved correctly. What I did is just to skip the null
    id'd chunks right ?
    Will there be any side effect to this ?

    Guglielmo_

     
  • Leon Bottou
    Leon Bottou
    2011-07-14

    This is very strange.
    Can you post the offending file and describe the problem more precisely?
    Enough to replicate?
    - L.