Load_IFF() improve compatibilty with malformed IFF files
This commit is contained in:
parent
c1f5ec0381
commit
2d7ecbda0c
@ -764,6 +764,8 @@ void Load_IFF(T_IO_Context * context)
|
|||||||
Read_dword_be(IFF_file, &aheader.bits);
|
Read_dword_be(IFF_file, &aheader.bits);
|
||||||
section_size -= 24;
|
section_size -= 24;
|
||||||
|
|
||||||
|
if ((aheader.bits & 0xffffffc0) != 0) // invalid ? => clearing
|
||||||
|
aheader.bits = 0;
|
||||||
fseek(IFF_file, (section_size+1)&~1, SEEK_CUR); // Skip remaining bytes
|
fseek(IFF_file, (section_size+1)&~1, SEEK_CUR); // Skip remaining bytes
|
||||||
}
|
}
|
||||||
else if (memcmp(section, "DPAN", 4) == 0) // Deluxe Paint ANimation
|
else if (memcmp(section, "DPAN", 4) == 0) // Deluxe Paint ANimation
|
||||||
@ -1608,7 +1610,7 @@ printf("%d x %d = %d %d\n", tiny_width, tiny_height, tiny_width*tiny_height, s
|
|||||||
{
|
{
|
||||||
PBM_Decode(context, IFF_file, header.Compression, context->Width, context->Height);
|
PBM_Decode(context, IFF_file, header.Compression, context->Width, context->Height);
|
||||||
}
|
}
|
||||||
if (section_size & 1)
|
if (ftell(IFF_file) & 1)
|
||||||
fseek(IFF_file, 1, SEEK_CUR); // SKIP one byte
|
fseek(IFF_file, 1, SEEK_CUR); // SKIP one byte
|
||||||
if (context->Type == CONTEXT_PREVIEW || context->Type == CONTEXT_PREVIEW_PALETTE)
|
if (context->Type == CONTEXT_PREVIEW || context->Type == CONTEXT_PREVIEW_PALETTE)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user