Jay Berkenbilt
ffe6af6f77
Add comments explaining the foreign object copying code
...
These are the comments I would have liked to have been able to read
while fixing #449 and #478 .
2020-10-31 12:14:26 -04:00
Jay Berkenbilt
96767fb104
Fix foreign stream copying bug ( fixes #478 )
...
This reverts an incorrect fix to #449 and codes it properly. The real
problem was that we were looking at the local dictionaries rather than
the foreign dictionaries when saving the foreign stream data. In the
case of direct objects, these happened to be the same, but in the case
of indirect objects, the object references could be pointing anywhere
since object numbers don't match up between the old and new files.
2020-10-31 12:14:26 -04:00
Jay Berkenbilt
da7540794a
Prepare 10.0.2 release
2020-10-27 11:57:48 -04:00
Jay Berkenbilt
09bd1fafb1
Improve efficiency of number to string conversion
2020-10-27 11:57:48 -04:00
Jay Berkenbilt
bcea54fcaa
Revert removal of unreadCh change for performance
...
Turns out unreadCh is much more efficient than seek(-1, SEEK_CUR).
Update comments and code to reflect this.
2020-10-27 11:57:48 -04:00
Jay Berkenbilt
b30deaeeab
Avoid merging adjacent tokens when concatenating contents ( fixes #444 )
2020-10-23 08:00:04 -04:00
Jay Berkenbilt
8a11feacc3
Avoid leak by resolving object streams more than once (fuzz issue 23642)
2020-10-22 15:39:36 -04:00
Jay Berkenbilt
30bb4c64ee
Minor code cleanup
...
* Return rather than exiting from realmain in qpdf.cc
* Remove extraneous blank line
* Don't assign temporary to const reference
2020-10-22 15:39:36 -04:00
Jay Berkenbilt
232f5fc9f3
Handle jpeg library fuzz false positives
...
The jpeg library has some assembly code that is missed by the compiler
instrumentation used by memory sanitization. There is a runtime
environment variable that is used to work around this issue.
2020-10-22 06:31:52 -04:00
Jay Berkenbilt
c1684eae91
Check for overflow in page labels (fuzz issue 23599)
2020-10-22 05:49:24 -04:00
Jay Berkenbilt
7f4a4df919
Add range_check method to QIntC
2020-10-22 05:48:40 -04:00
Jay Berkenbilt
24196c08cb
Fix loop detection error (fuzz issue 23172)
2020-10-22 05:48:35 -04:00
Jay Berkenbilt
956c8f6432
Obscure bug fix copying foreign streams in special cases ( fixes #449 )
...
Specifically, if a stream had its stream data replaced and had
indirect /Filter or /DecodeParms, it would result in non-silent loss
of data and/or internal error.
2020-10-21 19:23:23 -04:00
Jay Berkenbilt
98f6c00dad
Protect numeric conversion against user's locale ( fixes #459 )
2020-10-21 16:42:51 -04:00
Jay Berkenbilt
bed165c9fc
Stop using InputSource::unreadCh
2020-10-18 07:43:05 -04:00
Dean Scarff
153060a0c5
Check integer overflow in resolveObjectsInStream
...
Fixes a crash found by fuzzing.
2020-10-16 20:09:24 -04:00
Dean Scarff
9a3791c53b
Properly detect OPENSSL_IS_BORINGSSL
...
OPENSSL_IS_BORINGSSL is not actually set by configure, so it will be
undefined until a BoringSSL header is included. Hence the #ifdef logic
in QPDFCrypto_openssl.h would usually never apply.
This still worked because evp.h transitively included BoringSSL's
cipher.h and digest.h, but the latter are the correct (documented)
headers.
By re-ordering the includes, we can ensure the macro is defined when we
use it.
Also: fix case in the header guards.
2020-10-16 20:04:36 -04:00
Dean Scarff
2ff84aa2c9
Include detailed OpenSSL error messages
...
Fixes qpdf/qpdf#450
2020-10-16 19:58:11 -04:00
James R. Barlow
3fc7c99d02
Replace memchr with manual memory search
...
On large files with predominantly \n line endings, memchr(..'\r'..)
seems to waste a considerable amount of time searching for a line
ending candidate that we don't need.
On the Adobe PDF Reference Manual 1.7, this commit is 8x faster at
QPDF::processMemoryFile().
2020-10-16 19:57:29 -04:00
oltolm
3221022fc9
fix WindowsCryptProvider fixes #432
2020-10-16 19:56:33 -04:00
Jay Berkenbilt
ff65e272a8
Fix printf formatting for newer msvc
...
Use autoconf rather than ifdefs to determine what format string to use
for long long.
2020-10-16 07:02:23 -04:00
Jay Berkenbilt
88b8f8ec86
Remove redundant check found by lgtm.com
2020-10-15 14:47:43 -04:00
Jay Berkenbilt
26514ab731
Write linearization errors to stderr ( fixes #438 )
2020-04-29 17:33:34 -04:00
Jay Berkenbilt
92d3cbecd4
Fix warnings reported by -Wshadow=local ( fixes #431 )
2020-04-16 12:41:43 -04:00
Jay Berkenbilt
578c5ac66c
Use more references when iterating
...
When possible, use `for (auto&` or `for (auto const&` when iterating
using C++-11 style iterators.
2020-04-10 13:30:33 -04:00
Jay Berkenbilt
821a701851
Prepare 10.0.1 release
2020-04-09 11:48:26 -04:00
Jay Berkenbilt
1a7d3700a6
Fix unnecessary copies in auto iter ( fixes #426 )
...
Also switch to colon-style iteration in some cases. Thanks to Dean
Scarff for drawing this to my attention after detecting some
unnecessary copies with
https://clang.llvm.org/extra/clang-tidy/checks/performance-for-range-copy.html
2020-04-08 20:45:26 -04:00
Jay Berkenbilt
4977a7efa5
Bug fix: getStreamData should on unfilterable stream ( fixes #425 )
2020-04-08 18:52:04 -04:00
Jay Berkenbilt
1e629c278a
Prepare 10.0.0 release
2020-04-06 11:30:15 -04:00
Jay Berkenbilt
c996f4ac33
Don't include <cwchar> if not building with wchar
2020-04-06 11:23:02 -04:00
Jay Berkenbilt
77198d5310
Delegate random number generation to crypto provider ( fixes #418 )
2020-04-06 11:23:02 -04:00
Jay Berkenbilt
52749b85df
Make random data provider code thread-safe
...
This uses C++-11 thread-safe static initializers now.
2020-04-06 10:00:43 -04:00
Jay Berkenbilt
619d294e9d
Remove QUtil::srandom
2020-04-06 09:49:02 -04:00
Dean Scarff
0f2507234f
Add OpenSSL/BoringSSL crypto provider
...
Fixes qpdf/qpdf#417
2020-04-06 09:01:55 -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
7246404177
JSON: implement pattern keys in schema
2020-04-04 18:06:32 -04:00
Dean Scarff
c5c1a028cd
Use deterministic assignments for unique_id
...
Fixes qpdf/qpdf#419
2020-04-04 08:29:28 -04:00
Jay Berkenbilt
2100b4ce15
Allow qpdf to be built on systems without wchar_t ( fixes #406 )
2020-04-03 21:39:44 -04:00
Jay Berkenbilt
6a4117add9
Avoid potential segfault in warning methods
2020-04-03 21:39:20 -04:00
Jay Berkenbilt
4f3b89991b
placeFormXObject: allow control of shrink/expand ( fixes #409 )
2020-04-03 21:39:17 -04:00
Jay Berkenbilt
b76b73b229
C API: accept any non-zero value as TRUE
2020-04-03 17:33:44 -04:00
Jay Berkenbilt
54726930df
Remove redundant methods in QUtil
...
This was being saved until we had to break ABI.
2020-04-03 12:17:57 -04:00
Jay Berkenbilt
5806e5c60c
QPDFPageObjectHelper::placeFormXObject: use std::string const& ( fixes #374 )
2020-04-03 12:17:57 -04:00
Jay Berkenbilt
97de12343b
Performance: remove Members indirection for Pipeline
2020-04-03 12:17:57 -04:00
Jay Berkenbilt
bfda941519
Use an unordered map for SparseOHArray for efficiency
...
This was added in C++11.
2020-04-03 12:16:24 -04:00
Jay Berkenbilt
ee271fd2f2
Use auto for iterating over sparse array
2020-04-03 12:16:24 -04:00
Jay Berkenbilt
70665cb381
Internally use unsafeShallowCopy where we can
2020-04-03 12:16:24 -04:00
Jay Berkenbilt
38afdcea7b
Add QPDFObjectHandle::unsafeShallowCopy
2020-04-03 12:16:24 -04:00
Jay Berkenbilt
07afb668b1
Performance: remove indirection through Members for QPDFObject
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