Jay Berkenbilt
212812d837
Fix errors reported by Coverity
...
Thanks to Jiri Popelka from Red Hat for sending the output of a
Coverity run over qpdf.
2013-07-07 15:36:51 -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
690d6031db
Remove duplicated comment
2013-06-08 18:58:31 -04: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
6b9297882e
Mark secure CRT warnings with comment
...
Put a specific comment marker next to every piece of code that MSVC
gives warning 4996 for. This warning is generated for calls to
functions that Microsoft considers insecure or deprecated. This
change is in preparation for fixing all these cases even though none
of them are actually incorrect or insecure as used in qpdf. The
comment marker makes them easier to find so they can be fixed in
subsequent commits.
2013-03-05 13:33:32 -05:00
Jay Berkenbilt
30027481f7
Remove all old-style casts from C++ code
2013-03-04 16:45:16 -05:00
Jay Berkenbilt
9eb5982fa3
Avoid modifying trailer when writing
...
When preparing the trailer for writing to the new file, trim a copy of
the trailer instead of the original file's trailer.
2012-12-31 10:32:32 -05:00
Jay Berkenbilt
9a23c3dcb6
Remove /Crypt from stream filters unconditionally
...
When writing a new stream, always remove /Crypt even if we are not
otherwise able to filter the stream.
2012-12-31 10:32:32 -05:00
Jay Berkenbilt
4237a29c94
Refactor Dictionary writing code
...
Original code was written before we could shallow copy objects, so all
the filtering was done by suppressing the output of certain keys and
replacing them with other keys. Now we can simplify the code greatly
by modifying shallow copies of dictionaries in place.
2012-12-31 10:32:32 -05:00
Jay Berkenbilt
e57c25814e
Support for encryption with /V=5 and /R=5 and /R=6
...
Read and write support is implemented for /V=5 with /R=5 as well as
/R=6. /R=5 is the deprecated encryption method used by Acrobat IX.
/R=6 is the encryption method used by PDF 2.0 from ISO 32000-2.
2012-12-31 10:32:32 -05:00
Jay Berkenbilt
93ac1695a4
Support files with only attachments encrypted
...
Test cases added in a future commit since they depend on /R=6 support.
2012-12-31 10:32:32 -05:00
Jay Berkenbilt
9b42f526df
Update AES classes to work with 256-bit keys
2012-12-31 05:36:50 -05:00
Jay Berkenbilt
774584163f
Add ExtensionLevel support to version handling
...
All version operations are now fully aware of extension levels.
2012-12-31 05:36:50 -05:00
Jay Berkenbilt
3101955ac0
Add V5 parameters to EncryptionData
2012-12-31 05:36:50 -05:00
Jay Berkenbilt
04c203ae06
Eliminate flattenScalarReferences
2012-12-31 05:36:48 -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
c1627d0438
Add QPDFWriter::setExtraHeaderText
2012-09-06 15:31:12 -04:00
Jay Berkenbilt
8d2b29ef98
Fix segmentation fault with use of QPDFWriter::setOutputMemory
2012-09-06 14:39:06 -04:00
Jay Berkenbilt
b26ce88ea1
Minor fixes to copyEncryptionParameters
...
This fixes were to code added yesterday; the problems would not have
impacted any previously released code. These are all changes related
to the possibility that copyEncryptionParameters may be called on
behalf a different QPDF than the one being written.
2012-07-15 21:14:02 -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
8705e2e8fc
Add QPDFWriter method to output to FILE*
2012-07-05 21:24:04 -04:00
Jay Berkenbilt
1a3e88ca09
Fix large file support for 32-bit Linux
2012-06-25 10:51:44 -04:00
Jay Berkenbilt
c16db4106c
Increase padding in linearized files
...
With QPDF allowing integers to contain 64-bit quantities, this change
is necessary to be able to linearize files whose sizes might be larger
than 10 digits.
2012-06-24 15:56:59 -04:00
Jay Berkenbilt
8318d81ada
Fix and test support for files >= 4 GB
2012-06-24 15:56:50 -04:00
Jay Berkenbilt
781c313058
Change QPDF_Integer from int to long long
...
This makes it possible to store offsets that are larger than 2 GB in
the trailer dictionary.
2012-06-24 15:20:01 -04:00
Jay Berkenbilt
bf059a6001
Replace the 8-bit characters with \x.. in QPDFWriter.cc
...
This just makes it safer to pull up this file in an editor.
2012-06-23 09:05: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
11d33a45fa
Iterate of /Info's keys, not trailer's keys, to seed /ID
...
Thanks Tobias Hoffmann for noticing the error.
2012-06-21 15:52:53 -04:00
Jay Berkenbilt
5d4cad9c02
ABI change: fix use of off_t, size_t, and integer types
...
Significantly improve the code's use of off_t for file offsets, size_t
for memory sizes, and integer types in cases where there has to be
compatibility with external interfaces. Rework sections of the code
that would have prevented qpdf from working on files larger than 2 (or
maybe 4) GB in size.
2012-06-20 15:20:26 -04:00
Jay Berkenbilt
24e2b2b76f
Fix gcc 4.7 warnings about C++11
2012-06-20 15:18:14 -04:00
Jay Berkenbilt
788f6f7769
fix small logic error surrounding adding newlines; in practice, the logic error would probably never manifest itself without other code changes
2011-08-11 15:22:59 -04:00
Jay Berkenbilt
0abdf5381c
fix memory error caught by valgrind
2011-08-11 14:11:27 -04:00
Jay Berkenbilt
ce358f103e
remove stray XXX comment
2011-08-11 10:17:24 -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
7dc197ef88
implement replace and swap
2011-08-10 12:42:48 -04:00
Jay Berkenbilt
a7e269537d
update code to new PointerHolder, and reintroduce change that was accidentally backed out
...
git-svn-id: svn+q:///qpdf/trunk@1031 71b93d88-0707-0410-a8cf-f5a4172ac649
2010-09-24 20:45:18 +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
cd1e46616a
typo
...
git-svn-id: svn+q:///qpdf/trunk@985 71b93d88-0707-0410-a8cf-f5a4172ac649
2010-08-02 16:26:08 +00:00
Jay Berkenbilt
00ed5af502
remove use of float for version comparison
...
git-svn-id: svn+q:///qpdf/trunk@984 71b93d88-0707-0410-a8cf-f5a4172ac649
2010-08-02 16:18:46 +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
84353451a3
refactor to isolate pad calculation
...
git-svn-id: svn+q:///qpdf/trunk@956 71b93d88-0707-0410-a8cf-f5a4172ac649
2010-04-18 23:01:31 +00:00
Jay Berkenbilt
028f106bee
comment about flattenScalarReferences
...
git-svn-id: svn+q:///qpdf/trunk@945 71b93d88-0707-0410-a8cf-f5a4172ac649
2010-03-27 14:50:11 +00:00
Jay Berkenbilt
05a6d9669d
redo padding calculation for first half xref stream; old calculation
...
failed to consider the effect of compressing the strema
git-svn-id: svn+q:///qpdf/trunk@932 71b93d88-0707-0410-a8cf-f5a4172ac649
2010-01-24 22:05:16 +00:00
Jay Berkenbilt
b67a3c15e7
DLL.hh -> DLL.h, move public enumerated types into Constants.h and use them both for C and C++ interfaces
...
git-svn-id: svn+q:///qpdf/trunk@828 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-10-19 20:17:14 +00:00
Jay Berkenbilt
a8715c495b
add C API for R4 encryption
...
git-svn-id: svn+q:///qpdf/trunk@825 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-10-19 00:36:51 +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