Jay Berkenbilt
9b28933647
Check object ownership when adding
...
When adding a QPDFObjectHandle to an array or dictionary, if possible,
check if the new object belongs to the same QPDF. This makes it much
easier to find incorrect code than waiting for the situation to be
detected when the file is written.
2021-11-04 12:29:42 -04:00
Jay Berkenbilt
0b77f2cf26
Revert non-binary-compatible handleWarning change -- see TODO (ABI)
2021-03-04 15:59:46 -05:00
Jay Berkenbilt
f68e25c7f2
Don't use handleWarning, which is being reverted
2021-03-04 15:59:45 -05:00
Jay Berkenbilt
552303a94a
Check for reserved after dereference
2021-03-04 15:08:36 -05:00
Jay Berkenbilt
d7ffdfa994
Add optional conflict detection to mergeResources
...
Also improve behavior around direct vs. indirect resources.
2021-03-04 15:08:36 -05:00
Jay Berkenbilt
a15ec6967d
Enhancements to ParserCallbacks
2021-03-03 17:05:49 -05:00
Jay Berkenbilt
a4d6589ff2
Have QPDFObjectHandle notice when replaceObject was called
...
This results in a performance penalty of 1% to 2% when replaceObject
and swapObjects are never called and a somewhat larger penalty if they
are called, but it's worth it to avoid very confusing behavior as
discussed in depth in qpdf#507.
2021-02-25 07:32:46 -05:00
Jay Berkenbilt
ec6719fd25
Always call dereference() before querying obj pointer
2021-02-25 07:31:26 -05:00
Jay Berkenbilt
7b3cbacf5d
Change from QPDF{Array,Dict}Items to aitems() and ditems()
2021-02-22 11:05:39 -05:00
Jay Berkenbilt
92fbc6fdf5
QPDFObjectHandle::copyStream
2021-02-21 06:36:30 -05:00
Jay Berkenbilt
901f1a788c
Enhance QPDFMatrix API
2021-02-21 06:36:30 -05:00
Jay Berkenbilt
05eb5826d8
Fix isPagesObject and isPageObject
...
There are lots of things with /Kids that are not pages. Repair the
pages tree, then do a reliable check.
2021-02-20 19:42:41 -05:00
Jay Berkenbilt
35dd11f356
Allow --rotate=0
2021-02-20 16:29:34 -05:00
Jay Berkenbilt
a773f4c71d
Add QPDFObjectHandle::parse for strings with context
2021-02-15 11:33:03 -05:00
Jay Berkenbilt
efbb21673c
Add functional versions of QPDFObjectHandle::replaceStreamData
...
Also fix a bug in checking consistency of length for stream data
providers. Length should not be checked or recorded if the provider
says it failed to generate the data.
2021-02-14 14:42:24 -05:00
Jay Berkenbilt
07f40bd254
QUtil::double_to_string: trim trailing zeroes with option to disable
2021-02-13 02:30:00 -05:00
Jay Berkenbilt
4ae93a73c5
Improve memory safety of dict/array iterators
2021-01-31 07:16:03 -05:00
Jay Berkenbilt
de0b11fc47
Add C++ iterator API around array and dictionary objects
2021-01-30 15:15:23 -05:00
Jay Berkenbilt
35e7859bc7
Make QPDFObjectHandle::is* return false for uninitialized objects
2021-01-29 15:46:54 -05:00
Jay Berkenbilt
6226b69dba
Add warn() to QPDF's public API
2021-01-16 18:41:53 -05:00
Jay Berkenbilt
3be58f49e5
Make more QPDFPageObjectHelper methods work with form XObject
2021-01-02 14:08:53 -05:00
Jay Berkenbilt
bedf35d6a5
Bug fix: avoid extraneous pipeline finish calls with multiple contents
...
Avoid calling finish() multiple times on the pipeline passed to
pipeContentStreams. This commit also fixes a bug in which qpdf was not
exiting with the proper exit status if warnings found while splitting
pages; this was exposed by a test case that changed.
2021-01-02 14:08:17 -05:00
Jay Berkenbilt
a139d2b36d
Add several methods for working with form XObjects ( fixes #436 )
...
Make some more methods in QPDFPageObjectHelper work with form
XObjects, provide forEach methods to walk through nested form
XObjects, possibly recursively. This should make it easier to work
with form XObjects from user code.
2021-01-02 12:29:31 -05:00
Jay Berkenbilt
63ea46193d
QPDFPageObjectHelper: getPageImages -> getImages
2021-01-02 11:33:36 -05:00
Jay Berkenbilt
e7a8554563
QPDFPageObjectHelper::getPageImages: support form XObjects
2021-01-02 11:33:36 -05:00
Jay Berkenbilt
1562d34c09
Add QPDFObjectHandle::isFormXObject
2021-01-01 07:36:10 -05:00
Jay Berkenbilt
12ecd2019a
Add QPDFObjectHandle::setFilterOnWrite
2020-12-28 12:58:19 -05:00
Jay Berkenbilt
cc8895078a
Add QPDFObjectHandle::makeDirect(bool allow_streams)
2020-12-26 08:48:18 -05:00
Jay Berkenbilt
bd79138c84
Treat direct page as runtime rather than logic error (fuzz issue 27393)
2020-11-11 09:50:43 -05:00
Jay Berkenbilt
b30deaeeab
Avoid merging adjacent tokens when concatenating contents ( fixes #444 )
2020-10-23 08:00:04 -04:00
Jay Berkenbilt
92d3cbecd4
Fix warnings reported by -Wshadow=local ( fixes #431 )
2020-04-16 12:41:43 -04:00
Jay Berkenbilt
893d38b87e
Allow propagation of errors and retry through StreamDataProvider
...
StreamDataProvider::provideStreamData now has a rich enough API for it
to effectively proxy to pipeStreamData.
2020-04-05 20:07:13 -04:00
Jay Berkenbilt
6a4117add9
Avoid potential segfault in warning methods
2020-04-03 21:39:20 -04:00
Jay Berkenbilt
38afdcea7b
Add QPDFObjectHandle::unsafeShallowCopy
2020-04-03 12:16:24 -04:00
Jay Berkenbilt
89f19b7099
Performance: remove Members indirection for QPDFObjectHandle
2020-04-03 12:16:24 -04:00
Jay Berkenbilt
278710fbe8
Refactor QPDFPageObjectHelper::removeUnreferencedResources()
...
Refactor removeUnreferencedResources to prepare for filtering form
XObjects.
2020-03-31 17:39:20 -04:00
Masamichi Hosoda
5a842792b6
Parse Contents in signature dictionary without encryption
...
Various PDF digital signing tools do not encrypt /Contents value in
signature dictionary. Adobe Acrobat Reader DC can handle a PDF with
the /Contents value not encrypted.
Write Contents in signature dictionary without encryption
Tests ensure that string /Contents are not handled specially when not
found in sig dicts.
2019-10-22 16:20:21 -04:00
Masamichi Hosoda
cdc46d78f4
Add QPDFObject::getParsedOffset()
2019-10-22 16:19:06 -04:00
Jay Berkenbilt
685250d7d6
Correct reversed Rectangle coordinates ( fixes #363 )
2019-09-19 21:25:34 -04:00
Jay Berkenbilt
8b1e307741
Warn for duplicated dictionary keys ( fixes #345 )
2019-09-19 20:22:34 -04:00
Jay Berkenbilt
94e86e2528
Fix fuzz issue 16301
2019-08-25 22:52:25 -04:00
Jay Berkenbilt
3f1ab64066
Pass offset and length to ParserCallbacks::handleObject
2019-08-22 22:54:29 -04:00
Jay Berkenbilt
4b2e72c4cd
Test for direct, rather than resolved nulls in parser
...
Just because we know an indirect reference is null, doesn't mean we
shouldn't keep it indirect.
2019-08-22 17:55:16 -04:00
Jay Berkenbilt
225cd9dac2
Protect against coding error of re-entrant parsing
2019-08-22 17:55:16 -04:00
Jay Berkenbilt
42d396f1dd
Handle invalid name tokens symmetrically for PDF < 1.2 ( fixes #332 )
2019-08-19 19:48:27 -04:00
Jay Berkenbilt
5187a3ec85
Shallow copy arrays without removing sparseness
2019-08-17 23:02:41 -04:00
Jay Berkenbilt
bf7c6a8070
Use SparseOHArray in parsing
2019-08-17 23:02:41 -04:00
Jay Berkenbilt
a89d8a0677
Refactor QPDF_Array in preparation for using SparseOHArray
2019-08-17 23:02:41 -04:00
Jay Berkenbilt
e83f3308fb
SparseOHArray
2019-08-17 23:02:41 -04:00
Jay Berkenbilt
4db1de97ce
Convert some cases of logic_error to runtime_error
...
There were a few cases that could be caused by invalid input rather
than bugs in the code which were throwing logic_error instead of
runtime_error.
2019-06-25 12:43:06 -04:00