Jay Berkenbilt
4a4736c695
Fix EOL handling inside strings ( fixes #226 )
...
CR, CRLF, and LF are all supposed to be treated as LF; only one EOL is
to be ignored after backslash.
2018-08-05 20:48:35 -04:00
Jay Berkenbilt
1619cad1e8
Return correct method for string encryption ( fixes #227 )
2018-08-05 16:58:21 -04:00
Jay Berkenbilt
e1cd5891af
Fix infinite loop on small files with progress reporting ( fixes #230 )
...
Turns out you can keep adding zero to a number over and over again and
it just doesn't get any bigger. Who would have known?
2018-08-05 15:43:34 -04:00
Jay Berkenbilt
4f4c627b77
ClosedFileInputSource: add method to keep file open
...
During periods of intensive operation on a specific file, this method
can reduce the overhead of repeated open/close operations.
2018-08-04 19:52:46 -04:00
Jay Berkenbilt
1bd2a2e79b
Prepare 8.1.0 release
2018-06-23 07:50:11 -04:00
Jay Berkenbilt
3aad28aed0
Bug fix: honor encryption key length with R=3 ( fixes #212 )
2018-06-22 19:24:26 -04:00
Jay Berkenbilt
a433ed24f9
Add progress reporting for QPDFWriter ( fixes #200 )
2018-06-22 16:14:54 -04:00
Jay Berkenbilt
2a82f6e1e0
Add method to get count of objects in QPDF
2018-06-22 15:53:40 -04:00
Jay Berkenbilt
c81836076f
Correct incorrect comment
2018-06-22 13:13:09 -04:00
Jay Berkenbilt
4ccc8b1a44
Add ClosedFileInputSource
...
ClosedFileInputSource is an input source that keeps the file closed
when not reading it.
2018-06-22 12:52:45 -04:00
Jay Berkenbilt
c71dc6888c
Don't prune resource dictionaries on errors or by request
...
If we are unable to filter a page's content streams, don't attempt to
remove objects from the page's resource dictionary. Also provide a
command line option to suppress resource removal in case we ever need
this as a workaround for some bug or broken PDF files.
2018-06-22 10:45:31 -04:00
Jay Berkenbilt
38c9ed23c3
Treat content stream parsing errors as an error, not a warning
...
If parsing content streams is treated as a warning, there is no way
for a caller to know if a parsing operation has failed. This is very
dangerous and will likely result in data loss when token filters are
parser callbacks are in use.
2018-06-22 10:44:08 -04:00
Jay Berkenbilt
6c89d4b35b
When splitting files, remove unreferenced objects ( fixes #203 )
2018-06-21 21:03:30 -04:00
Jay Berkenbilt
ddd78c1b7f
Fix QPDFObjectHandle::shallowCopy
...
It's not really a shallow copy. It just doesn't cross indirect object
boundaries. The old implementation had a bug that would cause multiple
shallow copies of the same object to share memory, which was not the
intention.
2018-06-21 20:34:45 -04:00
Jay Berkenbilt
397b097c46
Allow setting a form field's value
2018-06-21 15:57:13 -04:00
Jay Berkenbilt
952a665a4e
Better support for creating Unicode strings
2018-06-21 15:57:13 -04:00
Jay Berkenbilt
e44c395c51
QUtil::toUTF16
2018-06-21 15:57:13 -04:00
Jay Berkenbilt
0b05111db8
Implement helper class for interactive forms
2018-06-21 15:57:13 -04:00
Jay Berkenbilt
2e7ee23bf6
Add QPDFPageDocumentHelper and QPDFPageObjectHelper
...
This is the beginning of higher-level API support using helper
classes. The goal is to be able to add more helpers without continuing
to pollute QPDF's and QPDFObjectHandle's public interfaces.
2018-06-21 15:57:13 -04:00
Jay Berkenbilt
4cded10821
Add QPDFObjectHandle::Rectangle type
...
Provide a convenient way of accessing rectangles.
2018-06-21 15:57:13 -04:00
Jay Berkenbilt
078cf9bf90
newline before endstream fix for object streams ( fixes #205 )
2018-05-12 13:17:43 -04:00
Jay Berkenbilt
15ed9f8565
Fix small logic error in Token construct ( fixes #206 )
...
The special case around name token was not reachable. This would only
affect constructors of name tokens that were represented in
non-canonical form such as with a hex substitution for a printable
character. The error was harmless but still a bug.
2018-05-05 17:47:56 -04:00
Jay Berkenbilt
b4d6cf6836
Limit depth of nesting in direct objects ( fixes #202 )
...
This fixes CVE-2018-9918.
2018-04-15 16:11:22 -04:00
Jay Berkenbilt
f8c8e4dcc0
Prepare 8.0.2 release
2018-03-06 11:34:07 -05:00
Jay Berkenbilt
e4e2e26d99
Properly handle pages with no contents ( fixes #194 )
...
Remove calls to assertPageObject(). All cases in the library that
called assertPageObject() work fine if you don't call
assertPageObject() because nothing assumes anything that was being
checked by that call. Removing the calls enables more files to be
successfully processed.
2018-03-06 11:34:07 -05:00
Jay Berkenbilt
1a4dcb4aaf
Pl_Buffer starts in a ready state
2018-03-06 11:31:03 -05:00
Jay Berkenbilt
ee44aef8d0
Treat loop in xref tables as damage ( fixes #192 )
...
Prior to this fix, if there was a loop detected in following /Prev
pointers in xref streams/tables, it would cause qpdf to lose data.
Note that this condition causes many PDF readers to hang or fail.
2018-03-05 14:26:58 -05:00
Jay Berkenbilt
6fe1e9de40
Prepare 8.0.1 release
2018-03-04 07:16:20 -05:00
Jay Berkenbilt
7b9f23a99a
Ignore zlib data check errors ( fixes #191 )
2018-03-03 11:35:01 -05:00
Jay Berkenbilt
3e8b643ae3
Release 8.0.0
2018-02-25 16:00:11 -05:00
Jay Berkenbilt
111ec50950
8.0.rc3
2018-02-25 14:17:59 -05:00
Jay Berkenbilt
d3d3970cf6
8.0.rc2
2018-02-25 13:50:22 -05:00
Jay Berkenbilt
a16d703f4d
Update version to 8.0.rc1
...
This is for testing the release process, particularly as it pertains
to AppImage creation.
2018-02-25 09:03:27 -05:00
Jay Berkenbilt
82cae01a76
Bump version number and soname
...
Bump to an alpha release. This version is not being widely released
but is being used to push the new shared library version through the
debian packaging system and to test out github releases.
2018-02-20 21:31:38 -05:00
Jay Berkenbilt
4bb3046f0b
Properly handle strings with PDF Doc Encoding ( fixes #179 )
...
The QPDF_String::getUTF8Val() method was not treating strings that
weren't explicitly Unicode as PDF Doc Encoded. This only affects
characters in the range 0x80 through 0xa0.
2018-02-18 21:06:27 -05:00
Jay Berkenbilt
2780a1871d
Add C API for checking PDF files
2018-02-18 21:06:27 -05:00
Jay Berkenbilt
d0e99f195a
More robust handling of type errors
...
Give objects descriptions and context so it is possible to issue
warnings instead of fatal errors for attempts to access objects of the
wrong type.
2018-02-18 21:06:27 -05:00
Jay Berkenbilt
c2e16827b6
Replace "file position" with "offset" in error messages
...
Sometimes it's an offset in an object stream or a content stream, so
file position is confusing in some cases.
2018-02-18 21:06:27 -05:00
Jay Berkenbilt
52e024f701
Include omitted object description in error message
2018-02-18 21:06:27 -05:00
Jay Berkenbilt
cb3b705cf9
Include filename in object stream parse error
2018-02-18 21:06:27 -05:00
Jay Berkenbilt
21b7481b0e
Push members of QPDFObjectHandle into a Members object
...
As in other cases, this is to enable adding new member variables in
the future without breaking ABI compatibility.
2018-02-18 21:06:27 -05:00
Jay Berkenbilt
e410b0fe0d
Simplify TokenFilter interface
...
Expose Pl_QPDFTokenizer, and have it do more of the work of managing
the token filter's pipeline.
2018-02-18 21:05:47 -05:00
Jay Berkenbilt
1fdd86a049
Move Pl_QPDFTokenizer to public interface
2018-02-18 21:05:47 -05:00
Jay Berkenbilt
5708b5d0aa
Add additional interface for filtering page contents
2018-02-18 21:05:47 -05:00
Jay Berkenbilt
fd02944e19
Clean up comment
2018-02-18 21:05:47 -05:00
Jay Berkenbilt
5136238f2a
Detect and report bad tokens in content normalization
2018-02-18 21:05:47 -05:00
Jay Berkenbilt
9910104442
Implement TokenFilter and refactor Pl_QPDFTokenizer
...
Implement a TokenFilter class and refactor Pl_QPDFTokenizer to use a
TokenFilter class called ContentNormalizer. Pl_QPDFTokenizer is now a
general filter that passes data through a TokenFilter.
2018-02-18 21:05:46 -05:00
Jay Berkenbilt
b8723e97f4
Add coalesce contents capability
2018-02-18 21:05:46 -05:00
Jay Berkenbilt
25988e8d10
Bug fix: content normalizer should not add trailing newline
...
Adding a trailing newline in content normalization damages files whose
contents are split across streams in the middle of tokens. Let
QPDFWriter add the newline with the indicator to ignore the newline,
which it already does. This changes the way some qdf files look.
2018-02-18 21:05:46 -05:00
Jay Berkenbilt
fcd611b61e
Refactor parseContentStream
2018-02-18 21:05:46 -05:00
Jay Berkenbilt
05ff619b09
Remove redundant method
...
Remove a redundant method that was equal to another one with
additional arguments. This breaks binary compatibility, but there are
other ABI breaking changes in the upcoming release, so now is the time
to do it.
2018-02-18 21:05:46 -05:00
Jay Berkenbilt
55ee55394c
Use inline image token in content parser
2018-02-18 21:05:46 -05:00
Jay Berkenbilt
ba453ba4ff
Use space tokens in tokenizer filter
2018-02-18 21:05:46 -05:00
Jay Berkenbilt
ec538792fa
Use inline image token type in tokenizer filter
2018-02-18 21:05:46 -05:00
Jay Berkenbilt
fefe25030e
Inline image token type
2018-02-18 21:05:46 -05:00
Jay Berkenbilt
2699ecf13e
Push QPDFTokenizer members into a nested structure
...
This is for protection against future ABI breaking changes.
2018-02-18 21:05:46 -05:00
Jay Berkenbilt
d97474868d
Lexer enhancements: EOF, comment, space
...
Significant enhancements to the lexer to improve EOF handling and to
support comments and spaces as tokens. Various other minor issues were
fixed as well.
2018-02-18 20:18:40 -05:00
Jay Berkenbilt
ebd5ed63de
Add option to save pass 1 of lineariziation
...
This is useful only for debugging the linearization code.
2018-02-18 20:18:40 -05:00
Jay Berkenbilt
2ebdd6929e
Prepare 7.1.1 release
2018-02-04 18:31:42 -05:00
Jay Berkenbilt
e3167c1a60
Fix linearization for files with nonstandard ID length
2018-02-04 18:16:23 -05:00
Jay Berkenbilt
3b2a3cdd77
Fix setLineBuf for bsd ( fixes #177 )
...
Use 0 instead of NULL in a cast.
2018-02-04 14:19:00 -05:00
Jay Berkenbilt
d5bfd49cb2
Remove use of std::abs ( fixes #172 )
...
Different compilers want different choices of headers for std::abs.
It's easier to just to not use it.
2018-02-04 14:19:00 -05:00
Jay Berkenbilt
34a9b835b0
Fix indentation
2018-02-04 14:19:00 -05:00
Jay Berkenbilt
7e5e1a7158
Fix offset in error message
2018-02-04 14:19:00 -05:00
Jay Berkenbilt
633fb414af
Pl_QPDFTokenizer: Use unsigned_char_pointer instead of copy
2018-01-28 18:34:43 -05:00
Jay Berkenbilt
13d9756a45
Minor fixes to tokenizer
2018-01-28 18:34:43 -05:00
Jay Berkenbilt
2e4ca7ecf4
Update version numbers for 7.1.0
2018-01-14 20:09:20 -05:00
Jay Berkenbilt
04e47deaf9
Fixes for clang
2018-01-14 19:18:04 -05:00
Jay Berkenbilt
569d74d36b
Allow raw encryption key to be specified
...
Add options to enable the raw encryption key to be directly shown or
specified. Thanks to Didier Stevens <didier.stevens@gmail.com> for the
idea and contribution of one implementation of this idea.
2018-01-14 10:21:05 -05:00
Jay Berkenbilt
3e306ae64c
Add QUtil::hex_decode
2018-01-14 09:04:13 -05:00
Jay Berkenbilt
791e0db762
Allow trailing . in numeric token ( fixes #165 )
2018-01-13 20:05:40 -05:00
Jay Berkenbilt
ec0087e3ce
Support TIFF Predictor ( fixes #171 )
2018-01-13 19:49:42 -05:00
Jay Berkenbilt
53971d50be
Add Pl_TIFFPredictor
2018-01-13 19:49:42 -05:00
Jay Berkenbilt
d9c9049708
Add signed support to BitStream and BitWriter
2018-01-13 19:49:42 -05:00
Jay Berkenbilt
661ed1d28e
Minor fixes to Pl_PNGFilter
...
Fix comment, remove restriction that doesn't actually matter.
2018-01-13 19:49:42 -05:00
Jay Berkenbilt
be27d47bdc
Use better error for getStreamData failure
...
If the stream isn't filterable but we call getStreamData, throw a
regular exception instead of a logic error so that normal error
handling and reporting mechanisms will be used.
2018-01-13 19:49:42 -05:00
Jay Berkenbilt
4edfe1f41d
Add tests for new PNG filters
2017-12-25 18:20:52 -05:00
Jay Berkenbilt
a3a55be9cd
Correct errors in PNG filters and make use from library
2017-12-25 14:24:48 -05:00
Casey Rojas
9a48720246
Initial implementation of other PNG decode filters
...
Initial implementation provided by Casey Rojas <crojas@infotechfl.com>
Some problems are fixed in a subsequent commit.
2017-12-24 22:59:51 -05:00
Jay Berkenbilt
0f1ce8e646
Prepare 7.0.0 release
2017-09-16 13:22:15 -04:00
Jay Berkenbilt
249e95f608
Fix test failure on MSVC
2017-09-15 23:09:04 -04:00
Jay Berkenbilt
6898bc8d98
Spell check
2017-09-15 23:09:04 -04:00
Jay Berkenbilt
f2ffb6968a
Fix Windows compilation errors
2017-09-15 21:44:57 -04:00
Jay Berkenbilt
d31a7b76e7
Improve message for stream decoding error
...
Tweak the message so that we inform the user that we are mitigating
data loss.
2017-09-12 16:03:48 -04:00
Jay Berkenbilt
eaacf94005
Update C API with new QPDFWriter methods
2017-09-12 14:30:39 -04:00
Jay Berkenbilt
40ecba4172
Pl_DCT: Use custom source and destination managers ( fixes #153 )
...
Avoid calling jpeg_mem_src and jpeg_mem_dest. The custom destination
manager writes to the pipeline in smaller chunks to avoid having the
whole image in memory at once. The source manager works directly with
the Buffer object. Using customer managers avoids use of memory source
and destination managers, which are not present in older versions of
libjpeg still in use by some Linux distributions.
2017-09-07 22:59:11 -04:00
Jay Berkenbilt
3ef1be9783
PNGFilter: Better range checking for columns
2017-08-31 07:26:58 -04:00
Jay Berkenbilt
1868a10f8b
Replace all atoi calls with QUtil::string_to_int
...
The latter catches underflow/overflow.
2017-08-29 12:28:32 -04:00
Jay Berkenbilt
742190bd98
Pl_PNGFilter: disallow columns = 0
2017-08-29 12:28:32 -04:00
Jay Berkenbilt
6d46346eb9
Detect integer overflow/underflow
2017-08-29 12:28:32 -04:00
Jay Berkenbilt
e999bbae43
Fix memory leak with bad jpeg data
2017-08-28 22:16:45 -04:00
Jay Berkenbilt
c6872d2c70
Clean up circular references in QPDF_Stream
2017-08-28 22:16:31 -04:00
Jay Berkenbilt
728dc9e6d8
Fix error caught by clang
2017-08-26 21:51:17 -04:00
Jay Berkenbilt
dea704f0ab
Pad keys to avoid memory errors ( fixes #147 )
2017-08-26 21:35:59 -04:00
Jay Berkenbilt
021c229331
Fix Pl_Flate memory leak on error ( fixes #148 )
2017-08-25 22:26:53 -04:00
Jay Berkenbilt
ad527a64f9
Parse iteratively to avoid stack overflow ( fixes #146 )
2017-08-25 21:56:45 -04:00
Jay Berkenbilt
85f05cc57f
Detect xref pointer infinite loop ( fixes #149 )
2017-08-25 19:58:31 -04:00
Jay Berkenbilt
1e52d33822
Bump soname to 18 and version to 7.0.b1
2017-08-22 16:50:48 -04:00
Jay Berkenbilt
e452d9dca6
Spell check
2017-08-22 14:22:20 -04:00
Jay Berkenbilt
6219111ed7
Update references to README files
...
Most of the README files have been renamed. Refer to the new names.
2017-08-22 14:13:10 -04:00