aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDF.cc
AgeCommit message (Collapse)Author
2019-06-21Fix sign and conversion warnings (major)Jay Berkenbilt
This makes all integer type conversions that have potential data loss explicit with calls that do range checks and raise an exception. After this commit, qpdf builds with no warnings when -Wsign-conversion -Wconversion is used with gcc or clang or when -W3 -Wd4800 is used with MSVC. This significantly reduces the likelihood of potential crashes from bogus integer values. There are some parts of the code that take int when they should take size_t or an offset. Such places would make qpdf not support files with more than 2^31 of something that usually wouldn't be so large. In the event that such a file shows up and is valid, at least qpdf would raise an error in the right spot so the issue could be legitimately addressed rather than failing in some weird way because of a silent overflow condition.
2019-06-15Eliminate one potential integer overflowJay Berkenbilt
There are more to handle, but this resolves an issue already caught by oss-fuzz.
2019-05-18Prepare 8.4.2 releaseJay Berkenbilt
2019-04-28Prepare 8.4.1 releaserelease-qpdf-8.4.1Jay Berkenbilt
2019-03-12Undefined functions because of missing std:: or header. (#295)Thorsten Schöning
* [bcc32 Error] QPDF.cc(375): E2268 Call to undefined function 'atof' Full parser context QPDF.cc(358): parsing: void QPDF::parse(const char *) * [bcc32 Error] QPDFTokenizer.cc(183): E2268 Call to undefined function 'strtol' Full parser context QPDFTokenizer.cc(163): parsing: void QPDFTokenizer::resolveLiteral() * [bcc32 Error] pdf-split-pages.cc(52): E2268 Call to undefined function 'exit' Full parser context pdf-split-pages.cc(50): parsing: void usage() * PR #295: Including "cstdlib" should be replaced with "stdlib.h" to be more consistent. At the same time I changed the order of the surrounding includes to reflect alphabetical order, because at some files this already have been the case.
2019-02-02Prepare 8.4.0 releaseJay Berkenbilt
2019-01-29Clarify documentation for copyForeignObject regarding pagesJay Berkenbilt
Make explicit that copyForeignObject can be used on page objects and will copy them properly but not update the pages tree.
2019-01-12Allow adding the same page more than once in --pages (fixes #272)Jay Berkenbilt
2019-01-11Add QPDF::setImmediateCopyFromJay Berkenbilt
2019-01-07Update version to 8.3.0Jay Berkenbilt
2019-01-07Exercise out of scope original pdf for copyForeignObjectJay Berkenbilt
2019-01-07Mostly don't require original QPDF for copyForeignObject (fixes #219)Jay Berkenbilt
The original QPDF is only required now when the source QPDFObjectHandle is a stream that gets its stream data from a QPDFObjectHandle::StreamDataProvider.
2019-01-07Make a static version of QPDF::pipeStreamDataJay Berkenbilt
This is in preparation of being able to pipe a stream's data without keeping a copy of its containing qpdf object.
2019-01-07Create an application-scope unique ID for each QPDF objectJay Berkenbilt
Use this instead of QPDF* as a map key for object_copiers.
2019-01-06Move encryption parameters into a classJay Berkenbilt
2019-01-04Don't call assert while checking linearization data (fixes #209, #231)Jay Berkenbilt
Instead of calling assert for problems found during checking linearization data, throw an exception which is later caught and issued as an error. Ideally we would handle errors more robustly, but this is still a significant improvement.
2019-01-04Fix dangling references (fixes #240)Jay Berkenbilt
On certain operations, such as iterating through all objects and adding new indirect objects, walk through the entire object structure and explicitly resolve any indirect references to non-existent objects. That prevents new objects from springing into existence and causing the previously dangling references to point to them.
2019-01-03Fix seg fault on empty xref stream (fixes #263)Jay Berkenbilt
Thanks to @p-cher for supplying a patch.
2018-08-18Prepare 8.2.1 releaserelease-qpdf-8.2.1Jay Berkenbilt
2018-08-16Prepare 8.2.0 releaserelease-qpdf-8.2.0Jay Berkenbilt
2018-06-23Prepare 8.1.0 releaserelease-qpdf-8.1.0Jay Berkenbilt
2018-06-22Add method to get count of objects in QPDFJay Berkenbilt
2018-03-06Prepare 8.0.2 releaserelease-qpdf-8.0.2Jay Berkenbilt
2018-03-05Treat loop in xref tables as damage (fixes #192)Jay Berkenbilt
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-04Prepare 8.0.1 releaserelease-qpdf-8.0.1Jay Berkenbilt
2018-02-25Release 8.0.0release-qpdf-8.0.0Jay Berkenbilt
2018-02-258.0.rc3release-qpdf-8.0.rc3Jay Berkenbilt
2018-02-258.0.rc2release-qpdf-8.0.rc2Jay Berkenbilt
2018-02-25Update version to 8.0.rc1release-qpdf-8.0.rc1Jay Berkenbilt
This is for testing the release process, particularly as it pertains to AppImage creation.
2018-02-21Bump version number and sonameJay Berkenbilt
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-19More robust handling of type errorsJay Berkenbilt
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-19Include omitted object description in error messageJay Berkenbilt
2018-02-19Include filename in object stream parse errorJay Berkenbilt
2018-02-05Prepare 7.1.1 releaserelease-qpdf-7.1.1Jay Berkenbilt
2018-02-04Fix offset in error messageJay Berkenbilt
2018-01-15Update version numbers for 7.1.0release-qpdf-7.1.0Jay Berkenbilt
2018-01-14Allow raw encryption key to be specifiedJay Berkenbilt
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.
2017-12-25Correct errors in PNG filters and make use from libraryJay Berkenbilt
2017-09-16Prepare 7.0.0 releaserelease-qpdf-7.0.0Jay Berkenbilt
2017-09-12Improve message for stream decoding errorJay Berkenbilt
Tweak the message so that we inform the user that we are mitigating data loss.
2017-08-29Replace all atoi calls with QUtil::string_to_intJay Berkenbilt
The latter catches underflow/overflow.
2017-08-26Detect xref pointer infinite loop (fixes #149)Jay Berkenbilt
2017-08-22Bump soname to 18 and version to 7.0.b1release-qpdf-7.0.b1Jay Berkenbilt
2017-08-22Limit token length during xref recoveryJay Berkenbilt
While scanning the file looking for objects, limit the length of tokens we allow. This prevents us from getting caught up in reading a file character by character while digging through large streams.
2017-08-22Fix logic error in recoveryJay Berkenbilt
A stray semicolon caused a condition to be incorrectly applied during stream length recovery.
2017-08-22Push QPDF member variables into a nested classJay Berkenbilt
Pushing member variables into a nested class enables addition of new member variables without breaking binary compatibility.
2017-08-21Enable finer grained control of stream decodingJay Berkenbilt
This commit adds several API methods that enable control over which types of filters QPDF will attempt to decode. It also adds support for /RunLengthDecode and /DCTDecode filters for both encoding and decoding.
2017-08-12Prevent a division by zero error (fixes #141)Jay Berkenbilt
Bad /W in an xref stream could cause a division by zero error. Now this is handled as a special case.
2017-08-11Read xref table without PCREJay Berkenbilt
Also accept more errors than before.
2017-08-11Reconstruct xref without PCREJay Berkenbilt