From abc69b3361088430714de88cc6bba74fd728f578 Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Mon, 18 Dec 2023 10:04:00 -0500 Subject: [PATCH] Save work. --- pdfio-crypto.c | 8 ++++++-- pdfio-stream.c | 6 +++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/pdfio-crypto.c b/pdfio-crypto.c index fda861a..6d630b2 100644 --- a/pdfio-crypto.c +++ b/pdfio-crypto.c @@ -409,11 +409,13 @@ _pdfio_crypto_cb_t // O - Decryption callback or `NULL` for none uint8_t data[21]; // Key data _pdfio_md5_t md5; // MD5 state uint8_t digest[16]; // MD5 digest value +#if PDFIO_OBJ_CRYPT pdfio_array_t *id_array; // Object ID array unsigned char *id_value; // Object ID value size_t id_len; // Length of object ID - uint8_t *file_key, // Computed file key to use - temp_key[16]; // File key for object + uint8_t temp_key[16]; // File key for object +#endif // PDFIO_OBJ_CRYPT + uint8_t *file_key; // Computed file key to use PDFIO_DEBUG("_pdfioCryptoMakeReader(pdf=%p, obj=%p(%d), ctx=%p, iv=%p, ivlen=%p(%d))\n", pdf, obj, (int)obj->number, ctx, iv, ivlen, (int)*ivlen); @@ -425,6 +427,7 @@ _pdfio_crypto_cb_t // O - Decryption callback or `NULL` for none return (NULL); } +#if PDFIO_OBJ_CRYPT if ((id_array = pdfioDictGetArray(pdfioObjGetDict(obj), "ID")) != NULL) { // Object has its own ID that will get used for encryption... @@ -471,6 +474,7 @@ _pdfio_crypto_cb_t // O - Decryption callback or `NULL` for none file_key = temp_key; } else +#endif // PDFIO_OBJ_CRYPT { // Use the default file key... file_key = pdf->file_key; diff --git a/pdfio-stream.c b/pdfio-stream.c index a0f6bc8..2bfdcae 100644 --- a/pdfio-stream.c +++ b/pdfio-stream.c @@ -1066,7 +1066,7 @@ stream_read(pdfio_stream_t *st, // I - Stream if ((status = inflate(&(st->flate), Z_NO_FLUSH)) < Z_OK) { - _pdfioFileError(st->pdf, "Unable to decompress stream data: %s", zstrerror(status)); + _pdfioFileError(st->pdf, "Unable to decompress stream data for object %ld: %s", (long)st->obj->number, zstrerror(status)); return (-1); } else if (avail_in == st->flate.avail_in && avail_out == st->flate.avail_out) @@ -1127,7 +1127,7 @@ stream_read(pdfio_stream_t *st, // I - Stream if ((status = inflate(&(st->flate), Z_NO_FLUSH)) < Z_OK) { - _pdfioFileError(st->pdf, "Unable to decompress stream data: %s", zstrerror(status)); + _pdfioFileError(st->pdf, "Unable to decompress stream data for object %ld: %s", (long)st->obj->number, zstrerror(status)); return (-1); } else if (status == Z_STREAM_END || (avail_in == st->flate.avail_in && avail_out == st->flate.avail_out)) @@ -1197,7 +1197,7 @@ stream_read(pdfio_stream_t *st, // I - Stream if ((status = inflate(&(st->flate), Z_NO_FLUSH)) < Z_OK) { - _pdfioFileError(st->pdf, "Unable to decompress stream data: %s", zstrerror(status)); + _pdfioFileError(st->pdf, "Unable to decompress stream data for object %ld: %s", (long)st->obj->number, zstrerror(status)); return (-1); } else if (status == Z_STREAM_END || (avail_in == st->flate.avail_in && avail_out == st->flate.avail_out))