2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-10-31 19:02:30 +00:00
Commit Graph

419 Commits

Author SHA1 Message Date
Jay Berkenbilt
c5dc6d8067 Remove unused PointerHolder interface
Also fix a bug resulting from incorrect use of PointerHolder because
of this unused parameter.
2017-08-10 19:01:38 -04:00
Jay Berkenbilt
49825e5cb6 Add --split-pages option (fixes #30) 2017-08-05 10:22:33 -04:00
Jay Berkenbilt
909daf9543 Move page spec processing earlier 2017-08-05 10:22:33 -04:00
Jay Berkenbilt
c88eaae2f2 Fix off-by-one error in --pages argument parsing (fixes #129) 2017-08-02 21:08:43 -04:00
iskander.sharipov
8ee83ca722 Add page rotation example in contrib
This is added to contrib rather than examples because it requires
c++-11 and lacks a test suite, but it is still useful enough to
include with the distribution.
2017-07-30 08:55:15 -04:00
Jay Berkenbilt
2d5b854468 Allow reading command-line args from files (fixes #16) 2017-07-29 22:23:21 -04:00
Jay Berkenbilt
5993c3e83c Detect input file = output file (fixes #29) 2017-07-29 20:58:01 -04:00
Jay Berkenbilt
885b8781cc Allow --check to coexist with and precede other operations (fixes #42) 2017-07-29 19:56:21 -04:00
Jay Berkenbilt
b43a0ac237 When recover stream length, indicate the length (fixes #44) 2017-07-29 19:15:06 -04:00
Jay Berkenbilt
f37d399d82 Add newline-before-endstream option (fixes #103) 2017-07-29 12:21:38 -04:00
Jay Berkenbilt
6a7d53ad2b Handle zlib data errors better (fixes #106) 2017-07-29 12:19:04 -04:00
Jay Berkenbilt
07d6f770b2 Better recovery of bad stream start (fixes #104) 2017-07-29 12:19:04 -04:00
Jay Berkenbilt
b389268f16 Better handle split content streams (fixes #73)
When parsing content streams, allow content to be split arbitrarily
across stream boundaries.
2017-07-29 12:19:04 -04:00
Jay Berkenbilt
3a1ff5ded9 Add option to preserve unreferenced objects 2017-07-28 19:19:11 -04:00
Jay Berkenbilt
7f8892525f Add precheck streams capability
When requested, QPDFWriter will do more aggress prechecking of streams
to make sure it can actually succeed in decoding them before
attempting to do so. This will allow preservation of raw data even
when the raw data is corrupted relative to the specified filters.
2017-07-27 23:42:27 -04:00
Jay Berkenbilt
a4fd4b91c6 Convert stream filtering errors to warnings 2017-07-27 18:43:07 -04:00
Jay Berkenbilt
40f00122b8 Convert object parsing errors to warnings
QPDFObjectHandle::parseInternal now issues warnings instead of
throwing exceptions for all error conditions that it finds (except
internal logic errors) and has stronger recovery for things like
invalid tokens and malformed dictionaries. This should improve qpdf's
ability to recover from a wide range of broken files that currently
cause it to fail.
2017-07-27 18:20:31 -04:00
Jay Berkenbilt
ac3c81a8ed Include tests for other infinite loop bugs
fixes #117
fixes #118
fixes #119
fixes #120

Several other infinite loop bugs were fixed by previous changes.
Include their test files in the test suite.
2017-07-26 06:24:07 -04:00
Jay Berkenbilt
12db09898e Don't interpret word tokens in content streams (fixes #82) 2017-07-26 06:24:07 -04:00
Jay Berkenbilt
701b518d5c Detect recursion loops resolving objects (fixes #51)
During parsing of an object, sometimes parts of the object have to be
resolved. An example is stream lengths. If such an object directly or
indirectly points to the object being parsed, it can cause an infinite
loop. Guard against all cases of re-entrant resolution of objects.
2017-07-26 06:24:07 -04:00
Jay Berkenbilt
afe0242b26 Handle object ID 0 (fixes #99)
This is CVE-2017-9208.

The QPDF library uses object ID 0 internally as a sentinel to
represent a direct object, but prior to this fix, was not blocking
handling of 0 0 obj or 0 0 R as a special case. Creating an object in
the file with 0 0 obj could cause various infinite loops. The PDF spec
doesn't allow for object 0. Having qpdf handle object 0 might be a
better fix, but changing all the places in the code that assumes objid
== 0 means direct would be risky.
2017-07-26 06:24:07 -04:00
Jay Berkenbilt
315092dd98 Avoid xref reconstruction infinite loop (fixes #100)
This is CVE-2017-9209.
2017-07-26 06:24:07 -04:00
Jay Berkenbilt
603f222365 Fix infinite loop while reporting an error (fixes #101)
This is CVE-2017-9210.

The description string for an error message included unparsing an
object, which is too complex of a thing to try to do while throwing an
exception. There was only one example of this in the entire codebase,
so it is not a pervasive problem. Fixing this eliminated one class of
infinite loop errors.
2017-07-26 06:24:07 -04:00
Jay Berkenbilt
b7302a9b72 Prepare 6.0.0 release 2015-11-10 12:48:52 -05:00
Jay Berkenbilt
e5abc789a2 Prepare 5.2.0 release 2015-11-01 16:40:01 -05:00
Jay Berkenbilt
b62cbe2508 Tolerate some mangled xref tables
If xref table entries lack the spec-required trailing whitespace or
contain a small amount of extra space, handle them anyway.
2015-10-31 18:56:43 -04:00
Jay Berkenbilt
b8bdef0ad1 Implement deterministic ID
For non-encrypted files, determinstic ID generation uses file contents
instead of timestamp and file name. At a small runtime cost, this
enables generation of the same /ID if the same inputs are converted in
the same way multiple times.
2015-10-31 18:56:42 -04:00
Jay Berkenbilt
94e55394ed Prepare 5.1.3 release 2015-05-24 17:26:49 -04:00
Jay Berkenbilt
b356b9dfa2 fix-qdf: handle object streams with > 255 objects
fix-qdf was previously hard-coding the number of bytes for the f2
field of the xref stream entry. This addresses issue #37. Thanks
aluebcke for reporting.
2015-05-24 16:52:42 -04:00
Jay Berkenbilt
cf43882e9f Handle Microsoft crypt provider without prior keys
As reported in issue #40, a call to CryptAcquireContext in
SecureRandomDataProvider fails in a fresh windows install prior to any
user keys being created in AppData\Roaming\Microsoft\Crypto\RSA.

Thanks michalrames.
2015-05-24 16:52:42 -04:00
Jay Berkenbilt
857bb208d3 include time.h in QUtil.hh
QUtil.hh needs time.h to get time_t on some platforms. Thanks Peter
Korsgaard <peter@korsgaard.com>
2015-05-24 16:26:05 -04:00
Jay Berkenbilt
a11549a566 Detect loops in /Pages structure
Pushing inherited objects to pages and getting all pages were both
prone to stack overflow infinite loops if there were loops in the
Pages dictionary. There is a general weakness in the code in that any
part of the code that traverses the Pages structure would be prone to
this and would have to implement its own loop detection. A more robust
fix may provide some general method for handling the Pages structure,
but it's probably not worth doing.

Note: addition of *Internal2 private functions was done rather than
changing signatures of existing methods to avoid breaking
compatibility.
2015-02-21 19:47:11 -05:00
Jay Berkenbilt
28a9df5119 Avoid buffer overrun copying digest
Converting a password to an encryption key is supposed to copy up to a
certain number of bytes from a digest. Make sure never to copy more
than the size of the digest.
2015-02-21 17:51:08 -05:00
Jay Berkenbilt
c729e07d55 Avoid resolving arguments to R
When checking two objects preceding R while parsing, ensure that the
objects are direct. This avoids stuff like 1 0 obj containing 1 0 R 0 R
from causing an infinite loop in object resolution.
2015-02-21 17:51:08 -05:00
Jay Berkenbilt
d8900c2255 Handle page tree node with no /Type
Original reported here:
https://bugs.launchpad.net/ubuntu/+source/qpdf/+bug/1397413

The PDF specification says that the /Type key for nodes in the pages
dictionary (both /Page and /Pages) is required, but some PDF files
omit them. Use the presence of other keys to determine the type of
pages tree node this is if the type key is not found.
2014-12-29 10:17:21 -05:00
Jay Berkenbilt
caab1b0e16 Handle pages with no /Contents from getPageContents()
The spec allows /Contents to be omitted for pages that are blank, but
QPDFObjectHandle::getPageContents() was throwing an exception in this
case.
2014-11-14 13:43:34 -05:00
Jay Berkenbilt
4071db59aa Prepare 5.1.2 release 2014-06-07 17:16:52 -04:00
Jay Berkenbilt
3c5e602a1e Windows build (msvc): target Windows 5.0.1 (XP)
Without this, qpdf executables work only on Vista or newer.

Fixes #35
2014-06-07 17:16:50 -04:00
Jay Berkenbilt
0b2e9cb168 Example: fast split into single pages
This is faster than using qpdf --pages to do it.
2014-06-07 16:40:38 -04:00
Jay Berkenbilt
9f8aba1db7 Handle indirect stream filter/decode parameters
QPDFWriter was trying to make /Filter and /DecodeParms direct in all
cases, but there are some cases where /DecodeParms may refer to a
stream, which can't be direct. QPDFWriter doesn't actually need
/DecodeParms to be direct in that case because it won't be able to
filter the stream. Until we can handle this type of stream, just don't
make /Filter and /DecodeParms direct if we can't filter the stream
anyway.

Fixes #34
2014-06-07 16:31:03 -04:00
Jay Berkenbilt
b0a96ce6aa Fix calculation of xref stream stream columns
Fix problem: if the last object in the first part of a linearized file
had an offset that was below 65536 by less than the size of the hint
stream, the xref stream was invalid and the resulting file is not
usable.
2014-02-22 22:13:31 -05:00
Jay Berkenbilt
247d70efee Prepare 5.1.1 release 2014-01-14 15:45:35 -05:00
Jay Berkenbilt
c9a9fe9c2f Avoid traversing same object twice when copying objects
This is a performance fix.  The output is unchanged.

Fixes #28.
2013-12-26 11:51:50 -05:00
Jay Berkenbilt
0b6127558d Prepare 5.1.0 release 2013-12-17 15:26:07 -05:00
Jay Berkenbilt
235d8f28f8 Increase random data provider support
Add a method to get the current random data provider, and document and
test the method for resetting it.
2013-12-16 16:21:28 -05:00
Jay Berkenbilt
30287d2d65 Allow OS-provided secure random to be disabled 2013-12-14 15:17:36 -05:00
Jay Berkenbilt
5e3bad2f86 Refactor random data generation
Add new RandomDataProvider object and implement existing random number
generation in terms of that.  This enables end users to supply their
own random data providers.
2013-12-14 15:17:35 -05:00
Jay Berkenbilt
e9a319fb95 Allow arbitrary whitespace, not just newline, after xref
Fixes #27.
2013-12-14 15:17:23 -05:00
Jay Berkenbilt
478c05fcab Allow -DNO_GET_ENVIRONMENT to avoid GetEnvironmentVariable
If NO_GET_ENVIRONMENT is #defined at compile time on Windows, do not
call GetEnvironmentVariable.  QUtil::get_env will always return
false.  This option is not available through configure.  This was
added to support a specific user's requirements to avoid calling
GetEnvironmentVariable from the Windows API.  Nothing in qpdf outside
the test coverage system in qtest relies on QUtil::get_env.
2013-11-30 15:58:32 -05:00
Jay Berkenbilt
88c29873e5 Add /FS flag (msvc) for parallel builds 2013-11-30 15:58:32 -05:00
Jay Berkenbilt
b75b19589d Add more detail to previous ChangeLog entry 2013-11-30 15:58:32 -05:00
Jay Berkenbilt
dc9df97466 Include <algorithm> for std::min, std::max 2013-11-29 10:48:16 -05:00
Jay Berkenbilt
157c936b97 Use 8 bit per sample images in tests
In compare image tests, use the gs device tiff24nc instead of tiff12nc
since the 4 bit per sample images created by tiff12nc could sometimes
trigger a bug in tiffcmp.  Fixes #20.
2013-11-21 13:41:37 -05:00
Jay Berkenbilt
c1e39381fa Add a ChangeLog note for previous fix 2013-11-21 13:30:58 -05:00
Jay Berkenbilt
e1bd72b46c Prepare for 5.0.1 release 2013-10-18 13:51:30 -04:00
Jay Berkenbilt
a237e92445 Warn when -accessibility=n will be ignored
Also accept -accessibility=n with 256 bit keys even though it will be
ignored.
2013-10-18 10:45:15 -04:00
Jay Berkenbilt
ac9c1f0d56 Security: replace operator[] with at
For std::string and std::vector, replace operator[] with at.  This was
done using an automated process.  See README.hardening for details.
2013-10-18 10:45:14 -04:00
Jay Berkenbilt
4229457068 Security: use a secure random number generator
If not available, give an error.  The user may also configure qpdf to
use an insecure random number generator.
2013-10-18 10:45:12 -04:00
Jay Berkenbilt
e19eb579b2 Replace some assertions with std::logic_error
Ideally, the library should never call assert outside of test code,
but it does in several places.  For some cases where the assertion
might conceivably fail because of a problem with the input data,
replace assertions with exceptions so that they can be trapped by the
calling application.  This commit surely misses some cases and
replaced some cases unnecessarily, but it should still be an
improvement.
2013-10-09 20:57:14 -04:00
Jay Berkenbilt
0bfe902489 Security: avoid pre-allocating vectors based on file data
In places where std::vector<T>(size_t) was used, either validate that
the size parameter is sane or refactor code to avoid the need to
pre-allocate the vector.
2013-10-09 20:57:14 -04:00
Jay Berkenbilt
10bceb552f Security: sanitize /W in xref stream
The /W array was not sanitized, possibly causing an integer overflow
in a multiplication. An analysis of the code suggests that there were
no possible exploits based on this since the problems were in checking
expected values but bounds checks were performed on actual values.
2013-10-09 20:57:07 -04:00
Jay Berkenbilt
3eb4b066ab Security: better bounds checks for linearization data
The faulty code was only used during explicit checks of linearization
data.  Those checks are not part of normal reading or writing of PDF
files.
2013-10-09 19:50:09 -04:00
Jay Berkenbilt
b097d7a81b Security: handle empty name in normalizeName 2013-10-09 19:50:09 -04:00
Jay Berkenbilt
eb1b1264b4 Security: fix potential multiplication overflow
Better sanity check inputs to bit stream reader
2013-10-09 19:50:09 -04:00
Jay Berkenbilt
c2e91d8ec3 Security: keep cur_byte pointing into bytes array 2013-10-09 19:50:07 -04:00
Jay Berkenbilt
66e63b8667 Prepare 5.0.0 release 2013-07-10 12:29:13 -04:00
Jay Berkenbilt
cee2592ed1 Change API/ABI and withdraw 4.2.0
4.2.0 was binary incompatible in spite of there being no deletions or
changes to any public methods.  As such, we have to bump the ABI and
are fixing some API breakage while we're at it.

Previous 4.3.0 target is now 5.1.0.
2013-07-10 11:30:13 -04:00
Jay Berkenbilt
f31e526d67 Prepare 4.2.0 release 2013-07-07 19:43:16 -04:00
Jay Berkenbilt
b84f57e56d Ignore broken DecodeParms for stream with no filters 2013-07-07 19:43:16 -04:00
Jay Berkenbilt
91367239fd Add --show-npages option to qpdf 2013-07-07 19:43:16 -04:00
Jay Berkenbilt
adccedc02f Allow numeric range to be omitted qpdf --pages
Detect a missing page range and assume 1-z.
2013-07-07 19:43:16 -04:00
Jay Berkenbilt
a85007cb0d Handle more broken files
Space rather than newline after xref, missing /ID in trailer for
encrypted file.  This enables qpdf to handle some files that xpdf can
handle.  Adobe reader can't necessarily handle them.
2013-06-15 12:40:01 -04:00
Jay Berkenbilt
16051788ed Handle /Outlines dictionary being a direct object
Even though this case is not valid according to the spec, it has been
seen, and caused an internal error.
2013-06-14 21:36:04 -04:00
Jay Berkenbilt
eae8370cd9 Add optional /Length key in crypt filter dictionary 2013-06-14 20:42:39 -04:00
Jay Berkenbilt
a3576a7359 Bug fix: handle generation > 0 when generating object streams
Rework QPDFWriter to always track old object IDs and QPDFObjGen
instead of int, thus not discarding the generation number.  Switch to
QPDF::getCompressibleObjGen() to properly handle the case of an old
object eligible for compression that has a generation of other than
zero.
2013-06-14 14:58:09 -04:00
Jay Berkenbilt
5039da0b91 Add QPDFObjectHandle::getObjGen()
This is safer than getObjectID() and getGeneration() for many uses.
2013-06-14 14:58:09 -04:00
Jay Berkenbilt
d88231e01e Promote QPDF::ObjGen to top-level object QPDFObjGen 2013-06-14 14:58:08 -04:00
Jay Berkenbilt
f02c5f5e12 Final preparation for 4.1.0 release 2013-04-14 15:03:51 -04:00
Jay Berkenbilt
e8ddac8950 Document casting policy 2013-03-25 14:37:25 -04:00
Jay Berkenbilt
49c7681c58 Windows install: check DLL type
When copying dlls, make sure to only consider DLLs whose type matches
the type of what is loading them.
2013-03-11 14:10:37 -04:00
Jay Berkenbilt
197af341de Use ./install-sh instead of install -c 2013-03-07 11:29:56 -05:00
Jay Berkenbilt
119f2a4b68 Add method to terminate content stream parsing 2013-03-05 13:35:46 -05:00
Jay Berkenbilt
fd64959398 Favor strerror_s and fopen_s on MSVC
Make remaining calls to fopen and strerror use strerror_s and fopen_s
on MSVC.
2013-03-05 13:35:46 -05:00
Jay Berkenbilt
ac4deac187 Call QUtil::safe_fopen in place of fopen
fopen was previuosly called wrapped by QUtil::fopen_wrapper, but
QUtil::safe_fopen does this itself, which is less cumbersome.
2013-03-05 13:35:46 -05:00
Jay Berkenbilt
a51ae10b8d Remove all calls to sprintf 2013-03-05 13:35:46 -05:00
Jay Berkenbilt
8be8277613 Rewrite QUtil::int_to_string and QUtil::double_to_string
Make them safer by avoiding any internal limits and replacing sprintf
with std::ostringstream.
2013-03-04 16:45:16 -05:00
Jay Berkenbilt
a11081085b Handle warning flags better
Make --enable-werror work properly on msvc, handle extra warnings
flags for msvc in configure.ac instead of hardcoding into
make/msvc.mk, separate warnings flags into WFLAGS in autoconf.mk to
avoid duplication and to make it easier to override.
2013-03-04 16:45:15 -05:00
Jay Berkenbilt
32b62035ce Replace many calls to sprintf with QUtil::hex_encode
Add QUtil::hex_encode to encode binary data has a hexadecimal string,
and use it in place of sprintf where possible.
2013-03-04 16:45:15 -05:00
Jay Berkenbilt
6c7bf114dc Bug fix: properly handle overridden compressed objects
When caching objects in an object stream, only cache objects that
still resolve to that stream.  See Changelog mod from this commit for
details.
2013-02-23 17:51:17 -05:00
Jay Berkenbilt
7e7c93951f Do not remove libqpdf.la
Some distributions (like debian) don't want .la files to be installed,
but the responsibility for doing this should like in the packaging,
not in qpdf itself.
2013-01-31 16:16:45 -05:00
Jay Berkenbilt
a5d8783f67 Improve qpdf --check
Fix exit status for case of errors without warnings, continue after
errors when possible, add test case for parsing a file with content
stream errors on some but not all pages.
2013-01-25 11:08:50 -05:00
Jay Berkenbilt
a7e8b8c789 Have qpdf --check parse content streams
Also move writing to null and parsing of content streams out of the
wrong if block.
2013-01-24 11:47:36 -05:00
Jay Berkenbilt
bfda717749 Cosmetic changes to be closer to Adobe terminology
Change object type Keyword to Operator, and place the order of the
object types in object_type_e in the same order as they are mentioned
in the PDF specification.

Note that this change only breaks backward compatibility with code
that has not yet been released.
2013-01-23 09:38:05 -05:00
Jay Berkenbilt
913eb5ac35 Add getTypeCode() and getTypeName()
Add virtual methods to QPDFObject, wrappers to QPDFObjectHandle, and
implementations to all the QPDF_Object types.
2013-01-22 10:01:45 -05:00
Jay Berkenbilt
f81152311e Add QPDFObjectHandle::parseContentStream method
This method allows parsing of the PDF objects in a content stream or
array of content streams.
2013-01-20 15:35:39 -05:00
Jay Berkenbilt
1d88955fa6 Added new QPDFObjectHandle types Keyword and InlineImage
These object types are to facilitate content stream parsing.
2013-01-20 15:35:39 -05:00
Jay Berkenbilt
8708fd373d Prepare 4.0.1 release 2013-01-17 09:51:04 -05:00
Jay Berkenbilt
0e9949afde Update versions for 4.0.0 release 2012-12-31 11:43:27 -05:00
Jay Berkenbilt
f8306913ba Update "C" API with functions for new features 2012-12-31 10:32:32 -05:00
Jay Berkenbilt
ae1385cd8a Update ChangeLog with recent changes 2012-12-31 10:32:32 -05:00
Jay Berkenbilt
04c203ae06 Eliminate flattenScalarReferences 2012-12-31 05:36:48 -05:00
Jay Berkenbilt
7f84239cad Find PDF header anywhere in the first 1024 bytes 2012-12-25 14:43:37 -05:00
Jay Berkenbilt
739a78e200 Add Requires.private to libqpdf.pc for static linking 2012-11-20 13:57:37 -05:00
Jay Berkenbilt
f256670eba Ignore objects with offset 0 2012-11-20 13:57:37 -05:00
Jay Berkenbilt
041397fdab Allow reading from InputSource and writing to Pipeline
Allowing users to subclass InputSource and Pipeline to read and write
from/to arbitrary sources provides the maximum flexibility for users
who want to read and write from other than files or memory.
2012-09-23 17:42:26 -04:00
Jay Berkenbilt
b4dc0f072a Prepare 3.0.2 release 2012-09-06 15:47:58 -04:00
Jay Berkenbilt
c1627d0438 Add QPDFWriter::setExtraHeaderText 2012-09-06 15:31:12 -04:00
Jay Berkenbilt
fc4c82a950 Reset state in QPDF::calculateLinearizationData
This makes it possible to use two different writers to write
linearized files from the same QPDF object.
2012-09-06 15:28:16 -04:00
Jay Berkenbilt
8d2b29ef98 Fix segmentation fault with use of QPDFWriter::setOutputMemory 2012-09-06 14:39:06 -04:00
Jay Berkenbilt
59432b5c70 Prepare 3.0.1 release 2012-08-11 13:41:18 -04:00
Jay Berkenbilt
29e9c34fe3 Bug fix: let EOF resolve literal token
Previously only whitespace and comments did it.  This fix is needed
for object streams whose last object is a literal (name, integer,
real, string) not terminated by space or newline.
2012-08-11 09:29:04 -04:00
Jay Berkenbilt
511e68758c Update version to 3.0.0 2012-08-02 06:52:33 -04:00
Jay Berkenbilt
4efc915fc1 Make release entry in ChangeLog 2012-07-29 14:44:12 -04:00
Jay Berkenbilt
f689324214 Restore coverage case
Previous commit lost coverage case for buffer-based replaceStreamData.
2012-07-25 22:32:14 -04:00
Jay Berkenbilt
31efe701ae Image comparison tests are off by default 2012-07-21 20:35:00 -04:00
Jay Berkenbilt
5a02471bb1 Command-line page merging and splitting
Implement --pages ... -- option for qpdf.  Update TODO with remaining
things to document.
2012-07-21 20:33:33 -04:00
Jay Berkenbilt
6bbea4baa0 Implement QPDFObjectHandle::parse
Move object parsing code from QPDF to QPDFObjectHandle and
parameterize the parts of it that are specific to a QPDF object.
Provide a version that can't handle indirect objects and that can be
called on an arbitrary string.

A side effect of this change is that the offset used when reporting
invalid stream length has changed, but since the new value seems like
a better value than the old one, the test suite has been updated
rather than making the code backward compatible.  This only effects
the offset reported for invalid streams that lack /Length or have an
invalid /Length key.

Updated some test code and exmaples to use QPDFObjectHandle::parse.

Supporting changes include adding a BufferInputSource constructor that
takes a string.
2012-07-21 09:06:10 -04:00
Jay Berkenbilt
a101533e0a Add command line option to copy encryption from other file
Add --copy-encryption and --encryption-file-password options to qpdf.
Also strengthen test suite for copying encryption.  The strengthened
test suite would have caught the failure to preserve AES and the
failure to update the file version, which was invalidating the
encrypted data.
2012-07-15 21:15:24 -04:00
Jay Berkenbilt
db95960ac1 Bug fix: preserve AES when copying encryption parameters 2012-07-15 19:07:59 -04:00
Jay Berkenbilt
0575d77d77 Add public QPDFWriter::copyEncryptionParameters
Method to copy encryption parameters from another file.  Adapted from
existing code to copy encryption parameters from the original file.
2012-07-14 09:14:41 -04:00
Jay Berkenbilt
1c944e4c89 Have QPDFWriter detect foreign objects while writing
Throw an exception that directs the user to QPDF::copyForeignObject.
2012-07-14 08:07:23 -04:00
Jay Berkenbilt
e7b8f297ba Support copying objects from another QPDF object
This includes QPDF::copyForeignObject and supporting foreign objects
as arguments to addPage*.
2012-07-11 15:54:33 -04:00
Jay Berkenbilt
8a217eb3a2 Add concept of reserved objects
QPDFObjectHandle::{new,is,assert}Reserved, QPDF::replaceReserved
provide a mechanism to add objects to a PDF file when there are
circular references.  This is a prerequisite to copying objects from
one PDF to another.
2012-07-10 23:34:32 -04:00
Jay Berkenbilt
e2dedde4bd Don't require stream data provider to know length in advance
Breaking API change: length parameter has disappeared from the
StreamDataProvider version of QPDFObjectHandle::replaceStreamData
since it is no longer necessary to compute it in advance.  This
breaking change is justified by the fact that removing the length
parameter provides the caller an opportunity to simplify the calling
code.
2012-07-07 17:33:45 -04:00
Jay Berkenbilt
8705e2e8fc Add QPDFWriter method to output to FILE* 2012-07-05 21:24:04 -04:00
Jay Berkenbilt
c227249ef1 Added test code for Tobias's changes 2012-07-04 23:19:32 -04:00
Jay Berkenbilt
a167ce8120 Update ChangeLog and TODO 2012-06-27 10:20:50 -04:00
Jay Berkenbilt
5c8d5b1a6c Update ChangeLog for previous fixes 2012-06-24 15:56:59 -04:00
Jay Berkenbilt
ffb96ee17e Add pdf-from-scratch example 2012-06-23 09:05:06 -04:00
Jay Berkenbilt
b6bdc0f595 Add factory methods for creating empty arrays and dictionaries.
Also updated pdf_from_scratch test driver to use the new factories,
and made some cosmetic improvements and documentation updates for the
emptyPDF() method.
2012-06-22 09:46:33 -04:00
Jay Berkenbilt
a0768e4190 Add QPDF::emptyPDF() and pdf_from_scratch test code 2012-06-21 23:09:05 -04:00
Jay Berkenbilt
30dbf94f53 Fix order of build flags.
Place user-specified CPPFLAGS and LDFLAGS later so that user-specified
non-standard paths that have old versions of qpdf don't cause the
build to fail.
2012-06-21 21:24:06 -04:00
Jay Berkenbilt
81e8752362 Use qpdf_offset_t in place of off_t in public APIs.
off_t is used internally only when needed to talk to standard
libraries.  This requires that the "long long" type be supported by
the compiler.
2012-06-21 21:23:24 -04:00
Jay Berkenbilt
c2e5ca48e0 ChangeLog entry for pkg-config files 2012-06-21 16:40:31 -04:00
Jay Berkenbilt
d1ebe30ff6 Add QPDFObjectHandle::shallowCopy() 2012-06-21 16:15:09 -04:00
Jay Berkenbilt
476ce7c407 ChangeLog entries for page API 2012-06-21 15:28:58 -04:00
Jay Berkenbilt
bbfaf43235 Fix spelling of Tobias's last name. Sorry about that! 2012-06-21 10:58:00 -04:00
Jay Berkenbilt
bc1c4bb578 Add QPDF::processFile that takes an open FILE* 2012-06-21 08:00:35 -04:00
Jay Berkenbilt
ed6a56a3cd add ChangeLog entries for previous work 2012-06-21 08:00:35 -04:00
Jay Berkenbilt
8e9fe21316 Update for 2.3.1 2011-12-28 17:19:40 -05:00
Jay Berkenbilt
92f0207de8 fix MSVC 2010 issues 2011-12-28 16:40:33 -05:00
Jay Berkenbilt
11314a9551 Don't declare any PCRE objects static. 2011-12-28 14:32:33 -05:00
Jay Berkenbilt
1d1d21d3fe ready for 2.3.0 release 2011-08-11 15:34:41 -04:00
Jay Berkenbilt
14fe2e6de3 qpdf_set_info_key, qpdf_get_info_key 2011-08-11 10:48:37 -04:00
Jay Berkenbilt
a42a4068b5 preserve /EncryptMetadata when copying encryption parameters 2011-08-10 19:47:18 -04:00
Jay Berkenbilt
759c56e1fe implement ability to save PDF to memory, also update ChangeLog 2011-08-10 16:34:29 -04:00
Jay Berkenbilt
04e12b3fee revert libtool updates; breaks with dash
git-svn-id: svn+q:///qpdf/trunk@1063 71b93d88-0707-0410-a8cf-f5a4172ac649
2011-06-25 18:58:44 +00:00
Jay Berkenbilt
9de1f4826b 2.2.4
git-svn-id: svn+q:///qpdf/trunk@1062 71b93d88-0707-0410-a8cf-f5a4172ac649
2011-06-25 18:39:05 +00:00
Jay Berkenbilt
37566259ee update libtool and autoconf files
git-svn-id: svn+q:///qpdf/trunk@1061 71b93d88-0707-0410-a8cf-f5a4172ac649
2011-06-25 16:52:09 +00:00
Jay Berkenbilt
a8a95fba47 disable -Werror by default, don't strip shared libraries and executables during install
git-svn-id: svn+q:///qpdf/trunk@1058 71b93d88-0707-0410-a8cf-f5a4172ac649
2011-06-23 18:40:37 +00:00
Jay Berkenbilt
e37d4d13e3 gcc 4.6 warnings
git-svn-id: svn+q:///qpdf/trunk@1057 71b93d88-0707-0410-a8cf-f5a4172ac649
2011-05-07 13:45:28 +00:00
Jay Berkenbilt
aeb892f99b accept stream keyword with CR only
git-svn-id: svn+q:///qpdf/trunk@1052 71b93d88-0707-0410-a8cf-f5a4172ac649
2011-04-30 21:46:09 +00:00
Jay Berkenbilt
c551b972f6 update version to 2.2.3, update copyright to 2011
git-svn-id: svn+q:///qpdf/trunk@1051 71b93d88-0707-0410-a8cf-f5a4172ac649
2011-04-30 19:19:30 +00:00
Jay Berkenbilt
6405d3928f be less conservative when skipping over inline images in content normalization
git-svn-id: svn+q:///qpdf/trunk@1050 71b93d88-0707-0410-a8cf-f5a4172ac649
2011-04-30 18:20:35 +00:00
Jay Berkenbilt
a8f2248729 handle files with object 0 as a real object
git-svn-id: svn+q:///qpdf/trunk@1049 71b93d88-0707-0410-a8cf-f5a4172ac649
2011-01-31 14:59:42 +00:00
Jay Berkenbilt
c595fd7fbf 2.2.2
git-svn-id: svn+q:///qpdf/trunk@1045 71b93d88-0707-0410-a8cf-f5a4172ac649
2010-10-04 15:26:40 +00:00
Jay Berkenbilt
df1fa5291c 2.2.1
git-svn-id: svn+q:///qpdf/trunk@1037 71b93d88-0707-0410-a8cf-f5a4172ac649
2010-10-01 11:07:12 +00:00
Jay Berkenbilt
a72ce95c92 setOutputStreams
git-svn-id: svn+q:///qpdf/trunk@1035 71b93d88-0707-0410-a8cf-f5a4172ac649
2010-10-01 11:02:35 +00:00
Jay Berkenbilt
9f444ffef3 add QPDF::processMemoryFile and API additions to support it
git-svn-id: svn+q:///qpdf/trunk@1034 71b93d88-0707-0410-a8cf-f5a4172ac649
2010-10-01 10:20:38 +00:00
Jay Berkenbilt
88706995c8 update
git-svn-id: svn+q:///qpdf/trunk@1032 71b93d88-0707-0410-a8cf-f5a4172ac649
2010-09-24 20:47:10 +00:00
Jay Berkenbilt
047bcfcaa6 treat empty objects as null
git-svn-id: svn+q:///qpdf/trunk@1027 71b93d88-0707-0410-a8cf-f5a4172ac649
2010-09-06 02:17:55 +00:00
Jay Berkenbilt
b1e0dcff16 handle stream filter abbreviations from table H.1
git-svn-id: svn+q:///qpdf/trunk@1025 71b93d88-0707-0410-a8cf-f5a4172ac649
2010-09-05 15:00:44 +00:00
Jay Berkenbilt
6b4d231245 2.2.0
git-svn-id: svn+q:///qpdf/trunk@1016 71b93d88-0707-0410-a8cf-f5a4172ac649
2010-08-14 16:43:18 +00:00
Jay Berkenbilt
8635f6302c document VC6 port
git-svn-id: svn+q:///qpdf/trunk@1015 71b93d88-0707-0410-a8cf-f5a4172ac649
2010-08-14 16:39:50 +00:00
Jay Berkenbilt
bd7261da9b getRawStreamData()
git-svn-id: svn+q:///qpdf/trunk@1010 71b93d88-0707-0410-a8cf-f5a4172ac649
2010-08-09 23:33:40 +00:00
Jay Berkenbilt
1ff024fafc update version numbers
git-svn-id: svn+q:///qpdf/trunk@1004 71b93d88-0707-0410-a8cf-f5a4172ac649
2010-08-08 21:19:58 +00:00
Jay Berkenbilt
cb1d89e763 invert images example
git-svn-id: svn+q:///qpdf/trunk@1001 71b93d88-0707-0410-a8cf-f5a4172ac649
2010-08-06 01:27:47 +00:00
Jay Berkenbilt
81b73bb9e9 notes
git-svn-id: svn+q:///qpdf/trunk@997 71b93d88-0707-0410-a8cf-f5a4172ac649
2010-08-05 21:54:15 +00:00
Jay Berkenbilt
9ba5b27ce4 add double-page-size example
git-svn-id: svn+q:///qpdf/trunk@996 71b93d88-0707-0410-a8cf-f5a4172ac649
2010-08-05 21:51:19 +00:00
Jay Berkenbilt
2dbc1006fb addPageContents
git-svn-id: svn+q:///qpdf/trunk@995 71b93d88-0707-0410-a8cf-f5a4172ac649
2010-08-05 21:06:49 +00:00
Jay Berkenbilt
9496b2cb20 fix memory leak
git-svn-id: svn+q:///qpdf/trunk@976 71b93d88-0707-0410-a8cf-f5a4172ac649
2010-06-06 13:32:08 +00:00
Jay Berkenbilt
f96c63cf3d 2.1.5
git-svn-id: svn+q:///qpdf/trunk@962 71b93d88-0707-0410-a8cf-f5a4172ac649
2010-04-25 15:05:11 +00:00
Jay Berkenbilt
b71cef856b fix linearization padding bug for second xref stream as well as first, which was previously fixed
git-svn-id: svn+q:///qpdf/trunk@957 71b93d88-0707-0410-a8cf-f5a4172ac649
2010-04-18 23:19:54 +00:00
Jay Berkenbilt
71f171356a change output message from qpdf --check when no errors are found
git-svn-id: svn+q:///qpdf/trunk@955 71b93d88-0707-0410-a8cf-f5a4172ac649
2010-04-10 13:43:16 +00:00
Jay Berkenbilt
117f690c8e update for 2.1.3
git-svn-id: svn+q:///qpdf/trunk@949 71b93d88-0707-0410-a8cf-f5a4172ac649
2010-03-27 16:03:04 +00:00
Jay Berkenbilt
a800b4eaa1 updated ChangeLog
git-svn-id: svn+q:///qpdf/trunk@947 71b93d88-0707-0410-a8cf-f5a4172ac649
2010-03-27 15:53:44 +00:00
Jay Berkenbilt
375b494e57 update for 2.1.2
git-svn-id: svn+q:///qpdf/trunk@934 71b93d88-0707-0410-a8cf-f5a4172ac649
2010-01-25 01:21:06 +00:00
Jay Berkenbilt
350d0b82f1 update test suite for 2.1.1 release
git-svn-id: svn+q:///qpdf/trunk@927 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-12-14 19:50:37 +00:00
Jay Berkenbilt
8fbba4d48c 2.1.1 -- gcc 4.4 fixes
git-svn-id: svn+q:///qpdf/trunk@925 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-12-14 02:35:31 +00:00
Jay Berkenbilt
fc5ca3b18c 2.1 -- changelog
git-svn-id: svn+q:///qpdf/trunk@912 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-10-30 23:57:02 +00:00
Jay Berkenbilt
d469111aa2 minor tweaks so rpm creation works properly in rhel5
git-svn-id: svn+q:///qpdf/trunk@911 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-10-27 01:51:56 +00:00
Jay Berkenbilt
bad4ff9683 set release date
git-svn-id: svn+q:///qpdf/trunk@904 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-10-24 13:23:45 +00:00
Jay Berkenbilt
a80d9d176d add C interface for getting software version
git-svn-id: svn+q:///qpdf/trunk@903 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-10-24 13:23:20 +00:00
Jay Berkenbilt
ace2a031b5 prepare 2.1.rc1 for release
git-svn-id: svn+q:///qpdf/trunk@901 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-10-24 04:47:17 +00:00
Jay Berkenbilt
398354b6f0 update C API for error retrieval
git-svn-id: svn+q:///qpdf/trunk@830 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-10-20 00:24:44 +00:00
Jay Berkenbilt
3f8c4c2736 categorize all error messages and include object information if available
git-svn-id: svn+q:///qpdf/trunk@829 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-10-19 23:09:19 +00:00
Jay Berkenbilt
09175e4578 more testing, bug fix for linearized aes encrypted files
git-svn-id: svn+q:///qpdf/trunk@824 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-10-19 00:17:11 +00:00
Jay Berkenbilt
4ccc9330a8 only seed randon number generater once for aes-cbc, try to avoid compressing Metadata streams
git-svn-id: svn+q:///qpdf/trunk@818 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-10-18 14:09:10 +00:00
Jay Berkenbilt
c2023db265 Implement changes suggested by Zarko and our subsequent conversations:
- Add a way to set the minimum PDF version
 - Add a way to force the PDF version
 - Have isEncrypted return true if an /Encrypt dictionary exists even
   when we can't read the file
 - Allow qpdf_init_write to be called multiple times
 - Update some comments in headers


git-svn-id: svn+q:///qpdf/trunk@748 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-10-05 00:42:48 +00:00
Jay Berkenbilt
c1e53f1480 bug fix: more gracefully handle xref stream with too many entries
git-svn-id: svn+q:///qpdf/trunk@747 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-10-04 23:56:56 +00:00
Jay Berkenbilt
8d7bb3ff50 add methods for getting encryption data
git-svn-id: svn+q:///qpdf/trunk@733 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-09-27 20:05:38 +00:00
Jay Berkenbilt
65bf77fa35 more tests of C API
git-svn-id: svn+q:///qpdf/trunk@728 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-09-27 16:55:24 +00:00
Jay Berkenbilt
f3d7c26de1 removed qexc; non-compatible ABI change
git-svn-id: svn+q:///qpdf/trunk@709 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-09-26 18:36:04 +00:00
Jay Berkenbilt
701e6db7b0 2.0.6
git-svn-id: svn+q:///qpdf/trunk@673 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-05-03 16:38:04 +00:00
Jay Berkenbilt
a345490886 2.0.5
git-svn-id: svn+q:///qpdf/trunk@669 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-03-10 16:26:57 +00:00
Jay Berkenbilt
c9bc8937e5 prepare for 2.0.5 release
git-svn-id: svn+q:///qpdf/trunk@667 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-03-09 16:59:37 +00:00
Jay Berkenbilt
f62bec3ee5 update test suite to handle original object ID comments
git-svn-id: svn+q:///qpdf/trunk@663 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-03-09 16:27:13 +00:00
Jay Berkenbilt
2af08ee398 checkpoint -- will have to finish another day
git-svn-id: svn+q:///qpdf/trunk@661 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-03-09 01:11:06 +00:00
Jay Berkenbilt
599daddb47 decode streams on check, always exit abnormally when warnings are detected
git-svn-id: svn+q:///qpdf/trunk@660 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-03-08 19:00:19 +00:00
Jay Berkenbilt
59c254e882 update version to 2.0.4
git-svn-id: svn+q:///qpdf/trunk@653 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-02-21 14:10:40 +00:00
Jay Berkenbilt
91cb7c0a58 fix many typos in comments and strings
git-svn-id: svn+q:///qpdf/trunk@651 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-02-21 02:54:31 +00:00
Jay Berkenbilt
0b2288c19d special exit status in --check mode with warnings and no errors
git-svn-id: svn+q:///qpdf/trunk@650 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-02-21 02:38:33 +00:00
Jay Berkenbilt
4499e04b57 better recovery for appended files with damaged cross-reference tables
git-svn-id: svn+q:///qpdf/trunk@649 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-02-21 02:31:32 +00:00
Jay Berkenbilt
da7166bead fix problem with lzw decoder when run without early code change, now that we actually have test input
git-svn-id: svn+q:///qpdf/trunk@646 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-02-20 02:27:36 +00:00
Jay Berkenbilt
9f93c89ee5 update copyright, release 2.0.3
git-svn-id: svn+q:///qpdf/trunk@644 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-02-15 16:31:12 +00:00
Jay Berkenbilt
caad089789 -help and -version
git-svn-id: svn+q:///qpdf/trunk@643 71b93d88-0707-0410-a8cf-f5a4172ac649
2008-12-12 03:17:25 +00:00
Jay Berkenbilt
07dc592182 gcc 4.4 fixes
git-svn-id: svn+q:///qpdf/trunk@642 71b93d88-0707-0410-a8cf-f5a4172ac649
2008-11-23 19:11:24 +00:00
Jay Berkenbilt
1f67d95e25 updated qtest
git-svn-id: svn+q:///qpdf/trunk@641 71b93d88-0707-0410-a8cf-f5a4172ac649
2008-11-23 19:01:11 +00:00
Jay Berkenbilt
337b900708 handle UTF-16BE fully
git-svn-id: svn+q:///qpdf/trunk@639 71b93d88-0707-0410-a8cf-f5a4172ac649
2008-11-23 18:49:13 +00:00
Jay Berkenbilt
212ca68f4f 2.0.2
git-svn-id: svn+q:///qpdf/trunk@634 71b93d88-0707-0410-a8cf-f5a4172ac649
2008-06-30 14:48:16 +00:00
Jay Berkenbilt
31dbfc0ef9 fix bashism
git-svn-id: svn+q:///qpdf/trunk@633 71b93d88-0707-0410-a8cf-f5a4172ac649
2008-06-08 00:46:06 +00:00
Jay Berkenbilt
658c11b1d2 changelog update
git-svn-id: svn+q:///qpdf/trunk@629 71b93d88-0707-0410-a8cf-f5a4172ac649
2008-05-07 15:43:35 +00:00
Jay Berkenbilt
1f5f559244 fix deps with libtool
git-svn-id: svn+q:///qpdf/trunk@623 71b93d88-0707-0410-a8cf-f5a4172ac649
2008-05-06 15:23:28 +00:00
Jay Berkenbilt
b3e38b984a changelog date
git-svn-id: svn+q:///qpdf/trunk@620 71b93d88-0707-0410-a8cf-f5a4172ac649
2008-05-05 14:45:06 +00:00
Jay Berkenbilt
f0cff46f48 update changelog
git-svn-id: svn+q:///qpdf/trunk@619 71b93d88-0707-0410-a8cf-f5a4172ac649
2008-05-05 14:33:34 +00:00
Jay Berkenbilt
fffc461a06 64-bit fix
git-svn-id: svn+q:///qpdf/trunk@611 71b93d88-0707-0410-a8cf-f5a4172ac649
2008-05-05 02:08:47 +00:00
Jay Berkenbilt
76bf91765e missing header files for gcc 4.3
git-svn-id: svn+q:///qpdf/trunk@607 71b93d88-0707-0410-a8cf-f5a4172ac649
2008-05-04 16:02:53 +00:00
Jay Berkenbilt
0ceb79cfdd missing strlen.h causes problems with gcc 4.3
git-svn-id: svn+q:///qpdf/trunk@606 71b93d88-0707-0410-a8cf-f5a4172ac649
2008-05-04 02:09:53 +00:00
Jay Berkenbilt
9a0b88bf77 update release date to actual date
git-svn-id: svn+q:///qpdf/trunk@599 71b93d88-0707-0410-a8cf-f5a4172ac649
2008-04-29 12:55:25 +00:00