mirror of
https://github.com/qpdf/qpdf.git
synced 2025-02-12 00:28:31 +00:00
Change QPDFWriter stream_decode_level default to qpdf_dl_generalized
Also, fix disabling of preserve_encryption to be ignore stream_decode_level, but disable preserve_encryption if compress_streams is false. Fixes #1286
This commit is contained in:
parent
ff0affd81d
commit
718b14008b
@ -3,6 +3,11 @@
|
|||||||
* Add C API function qpdf_oh_free_buffer to release memory allocated
|
* Add C API function qpdf_oh_free_buffer to release memory allocated
|
||||||
by stream data functions.
|
by stream data functions.
|
||||||
|
|
||||||
|
2024-09-19 M Holger <m.holger@qpdf.org>
|
||||||
|
|
||||||
|
* Bug fix: QPDFWriter stream DecodeLevel incorrectly defaulted to
|
||||||
|
none instead of generalied. Fixes #1286.
|
||||||
|
|
||||||
2024-08-25 M Holger <m.holger@qpdf.org>
|
2024-08-25 M Holger <m.holger@qpdf.org>
|
||||||
|
|
||||||
* Add new command-line arguments --remove-metadata and --remove-info
|
* Add new command-line arguments --remove-metadata and --remove-info
|
||||||
|
@ -2126,7 +2126,7 @@ QPDFWriter::doWriteSetup()
|
|||||||
if (m->encrypted) {
|
if (m->encrypted) {
|
||||||
// Encryption has been explicitly set
|
// Encryption has been explicitly set
|
||||||
m->preserve_encryption = false;
|
m->preserve_encryption = false;
|
||||||
} else if (m->normalize_content || m->stream_decode_level || m->pclm || m->qdf_mode) {
|
} else if (m->normalize_content || !m->compress_streams || m->pclm || m->qdf_mode) {
|
||||||
// Encryption makes looking at contents pretty useless. If the user explicitly encrypted
|
// Encryption makes looking at contents pretty useless. If the user explicitly encrypted
|
||||||
// though, we still obey that.
|
// though, we still obey that.
|
||||||
m->preserve_encryption = false;
|
m->preserve_encryption = false;
|
||||||
|
@ -65,7 +65,7 @@ class QPDFWriter::Members
|
|||||||
bool normalize_content{false};
|
bool normalize_content{false};
|
||||||
bool compress_streams{true};
|
bool compress_streams{true};
|
||||||
bool compress_streams_set{false};
|
bool compress_streams_set{false};
|
||||||
qpdf_stream_decode_level_e stream_decode_level{qpdf_dl_none};
|
qpdf_stream_decode_level_e stream_decode_level{qpdf_dl_generalized};
|
||||||
bool stream_decode_level_set{false};
|
bool stream_decode_level_set{false};
|
||||||
bool recompress_flate{false};
|
bool recompress_flate{false};
|
||||||
bool qdf_mode{false};
|
bool qdf_mode{false};
|
||||||
|
@ -723,7 +723,7 @@ $td->runtest("check file's validity",
|
|||||||
$td->runtest("handle missing/invalid Length",
|
$td->runtest("handle missing/invalid Length",
|
||||||
{$td->COMMAND => "qpdf --check bad-encryption-length.pdf"},
|
{$td->COMMAND => "qpdf --check bad-encryption-length.pdf"},
|
||||||
{$td->FILE => "bad-encryption-length.out",
|
{$td->FILE => "bad-encryption-length.out",
|
||||||
$td->EXIT_STATUS => 0},
|
$td->EXIT_STATUS => 3},
|
||||||
$td->NORMALIZE_NEWLINES);
|
$td->NORMALIZE_NEWLINES);
|
||||||
|
|
||||||
cleanup();
|
cleanup();
|
||||||
|
@ -56,7 +56,7 @@ $td->runtest("externalize damaged image",
|
|||||||
"qpdf --externalize-inline-images" .
|
"qpdf --externalize-inline-images" .
|
||||||
" --compress-streams=n --static-id" .
|
" --compress-streams=n --static-id" .
|
||||||
" damaged-inline-image.pdf a.pdf"},
|
" damaged-inline-image.pdf a.pdf"},
|
||||||
{$td->STRING => "", $td->EXIT_STATUS => 0},
|
{$td->FILE => "damaged-inline-image.out", $td->EXIT_STATUS => 3},
|
||||||
$td->NORMALIZE_NEWLINES);
|
$td->NORMALIZE_NEWLINES);
|
||||||
$td->runtest("check output",
|
$td->runtest("check output",
|
||||||
{$td->FILE => "a.pdf"},
|
{$td->FILE => "a.pdf"},
|
||||||
|
@ -14,5 +14,5 @@ modify annotations: allowed
|
|||||||
modify other: allowed
|
modify other: allowed
|
||||||
modify anything: allowed
|
modify anything: allowed
|
||||||
File is not linearized
|
File is not linearized
|
||||||
No syntax or stream encoding errors found; the file may still contain
|
WARNING: bad-encryption-length.pdf, object 7 0 at offset 531 -> dictionary key /Length: operation for integer attempted on object of type null: returning 0
|
||||||
errors that qpdf cannot detect
|
qpdf: operation succeeded with warnings
|
||||||
|
3
qpdf/qtest/qpdf/damaged-inline-image.out
Normal file
3
qpdf/qtest/qpdf/damaged-inline-image.out
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
WARNING: damaged-inline-image.pdf, stream object 8 0: error while getting stream data: stream inflate: inflate: data: invalid distance too far back
|
||||||
|
WARNING: damaged-inline-image.pdf, stream object 8 0: qpdf will attempt to write the damaged stream unchanged
|
||||||
|
qpdf: operation succeeded with warnings; resulting file may have some problems
|
@ -6,6 +6,11 @@ WARNING: fuzz-16214.pdf (xref stream, offset 116): Cross-reference stream data h
|
|||||||
WARNING: fuzz-16214.pdf: reported number of objects (6) is not one plus the highest object number (35)
|
WARNING: fuzz-16214.pdf: reported number of objects (6) is not one plus the highest object number (35)
|
||||||
WARNING: fuzz-16214.pdf (object 14 0, offset 652): expected dictionary key but found non-name object; inserting key /QPDFFake1
|
WARNING: fuzz-16214.pdf (object 14 0, offset 652): expected dictionary key but found non-name object; inserting key /QPDFFake1
|
||||||
WARNING: fuzz-16214.pdf (object 14 0, offset 734): expected endobj
|
WARNING: fuzz-16214.pdf (object 14 0, offset 734): expected endobj
|
||||||
|
WARNING: fuzz-16214.pdf (object 15 0, offset 869): unknown token while reading object; treating as string
|
||||||
|
WARNING: fuzz-16214.pdf (object 15 0, offset 745): expected dictionary key but found non-name object; inserting key /QPDFFake1
|
||||||
|
WARNING: fuzz-16214.pdf (object 15 0, offset 894): expected endobj
|
||||||
|
WARNING: fuzz-16214.pdf, object 15 0 at offset 745: kid 0 (from 0) MediaBox is undefined; setting to letter / ANSI A
|
||||||
|
WARNING: fuzz-16214.pdf, object 15 0 at offset 745: /Type key should be /Page but is not; overriding
|
||||||
WARNING: fuzz-16214.pdf: file is damaged
|
WARNING: fuzz-16214.pdf: file is damaged
|
||||||
WARNING: fuzz-16214.pdf (object 1 0, offset 7189): expected n n obj
|
WARNING: fuzz-16214.pdf (object 1 0, offset 7189): expected n n obj
|
||||||
WARNING: fuzz-16214.pdf: Attempting to reconstruct cross-reference table
|
WARNING: fuzz-16214.pdf: Attempting to reconstruct cross-reference table
|
||||||
|
@ -15,4 +15,6 @@ modify annotations: allowed
|
|||||||
modify other: not allowed
|
modify other: not allowed
|
||||||
modify anything: not allowed
|
modify anything: not allowed
|
||||||
File is not linearized
|
File is not linearized
|
||||||
|
WARNING: invalid-id-xref.pdf, trailer at offset 910 -> dictionary key /ID: operation for array attempted on object of type null: returning null
|
||||||
|
WARNING: invalid-id-xref.pdf, trailer at offset 910 -> dictionary key /ID -> null returned from invalid array access: operation for string attempted on object of type null: returning empty string
|
||||||
qpdf: operation succeeded with warnings
|
qpdf: operation succeeded with warnings
|
||||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user