mirror of
https://github.com/michaelrsweet/pdfio.git
synced 2024-11-16 02:18:24 +01:00
Fix PNG CRC calculation (doesn't include length for some reason...)
This commit is contained in:
parent
466cb473d1
commit
2fbf9dc3b2
@ -1665,7 +1665,7 @@ copy_png(pdfio_dict_t *dict, // I - Dictionary
|
|||||||
// Get the chunk length and type values...
|
// Get the chunk length and type values...
|
||||||
length = (unsigned)((buffer[0] << 24) | (buffer[1] << 16) | (buffer[2] << 8) | buffer[3]);
|
length = (unsigned)((buffer[0] << 24) | (buffer[1] << 16) | (buffer[2] << 8) | buffer[3]);
|
||||||
type = (unsigned)((buffer[4] << 24) | (buffer[5] << 16) | (buffer[6] << 8) | buffer[7]);
|
type = (unsigned)((buffer[4] << 24) | (buffer[5] << 16) | (buffer[6] << 8) | buffer[7]);
|
||||||
crc = update_png_crc(0xffffffff, buffer, 8);
|
crc = update_png_crc(0xffffffff, buffer + 4, 4);
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
@ -1969,9 +1969,9 @@ copy_png(pdfio_dict_t *dict, // I - Dictionary
|
|||||||
temp = (unsigned)((buffer[0] << 24) | (buffer[1] << 16) | (buffer[2] << 8) | buffer[3]);
|
temp = (unsigned)((buffer[0] << 24) | (buffer[1] << 16) | (buffer[2] << 8) | buffer[3]);
|
||||||
if (temp != crc)
|
if (temp != crc)
|
||||||
{
|
{
|
||||||
// pdfioStreamClose(st);
|
pdfioStreamClose(st);
|
||||||
_pdfioFileError(dict->pdf, "Bad CRC (0x%08x != 0x%08x).", temp, crc);
|
_pdfioFileError(dict->pdf, "Bad CRC (0x%08x != 0x%08x).", temp, crc);
|
||||||
// return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user