aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDFObjectHandle.cc
AgeCommit message (Collapse)Author
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-27Fix error caught by clangJay Berkenbilt
2017-08-26Parse iteratively to avoid stack overflow (fixes #146)Jay Berkenbilt
2017-08-22Spell checkJay Berkenbilt
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-13Add page rotation (fixes #132)Jay Berkenbilt
2017-07-29Better handle split content streams (fixes #73)Jay Berkenbilt
When parsing content streams, allow content to be split arbitrarily across stream boundaries.
2017-07-28Add precheck streams capabilityJay Berkenbilt
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-28Convert object parsing errors to warningsJay Berkenbilt
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-26Don't interpret word tokens in content streams (fixes #82)Jay Berkenbilt
2017-07-26Handle object ID 0 (fixes #99)Jay Berkenbilt
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-26Fix infinite loop while reporting an error (fixes #101)Jay Berkenbilt
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.
2015-02-21Avoid resolving arguments to RJay Berkenbilt
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.
2014-11-14Handle pages with no /Contents from getPageContents()Jay Berkenbilt
The spec allows /Contents to be omitted for pages that are blank, but QPDFObjectHandle::getPageContents() was throwing an exception in this case.
2013-10-18Security: replace operator[] with atJay Berkenbilt
For std::string and std::vector, replace operator[] with at. This was done using an automated process. See README.hardening for details.
2013-07-07Fix errors reported by CoverityJay Berkenbilt
Thanks to Jiri Popelka from Red Hat for sending the output of a Coverity run over qpdf.
2013-06-14Add QPDFObjectHandle::getObjGen()Jay Berkenbilt
This is safer than getObjectID() and getGeneration() for many uses.
2013-04-04Add explicit int to double castJay Berkenbilt
2013-03-05Fix getTypeCode and getTypeName work for indirect objectsJay Berkenbilt
Remove const qualifier from getTypeCode and get getTypeName methods of QPDFObjectHandle, make them work properly for indirect objects, and exercise them much better in the test suite.
2013-03-05Add method to terminate content stream parsingJay Berkenbilt
2013-03-04Remove all old-style casts from C++ codeJay Berkenbilt
2013-01-25Improve qpdf --checkJay Berkenbilt
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-23Cosmetic changes to be closer to Adobe terminologyJay Berkenbilt
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-22Add getTypeCode() and getTypeName()Jay Berkenbilt
Add virtual methods to QPDFObject, wrappers to QPDFObjectHandle, and implementations to all the QPDF_Object types.
2013-01-20Add QPDFObjectHandle::parseContentStream methodJay Berkenbilt
This method allows parsing of the PDF objects in a content stream or array of content streams.
2013-01-20Added new QPDFObjectHandle types Keyword and InlineImageJay Berkenbilt
These object types are to facilitate content stream parsing.
2012-07-25added QPDFObjectHandle::replaceStreamData(std::string data).Tobias Hoffmann
2012-07-21Implement QPDFObjectHandle::parseJay Berkenbilt
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-15qpdf: push inherited attributes to page when showing imagesJay Berkenbilt
from qpdf command-line tool
2012-07-11Support copying objects from another QPDF objectJay Berkenbilt
This includes QPDF::copyForeignObject and supporting foreign objects as arguments to addPage*.
2012-07-11Add concept of reserved objectsJay Berkenbilt
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-08Added assertNumber and assertScalar to QPDFObjectHandleTobias Hoffmann
2012-07-08Added public assert{Type} methods to QPDFObjectHandleTobias Hoffmann
2012-07-07Don't require stream data provider to know length in advanceJay Berkenbilt
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-06-27Add a few minor enhancements to recent workJay Berkenbilt
Test coverage case for new newStream method Expose decimal_places argument for double-based newReal All enhancements suggested by Tobias.
2012-06-27Add QPDFObjectHandle::newStream(QPDF *, std::string const&)Tobias Hoffmann
This makes the code simpler than having to create a buffer of a fixed size and copy the string to it.
2012-06-27Add QPDFObjectHandle::newReal(double)Tobias Hoffmann
2012-06-24Change QPDF_Integer from int to long longJay Berkenbilt
This makes it possible to store offsets that are larger than 2 GB in the trailer dictionary.
2012-06-22Switch some code to use empty newArray/newDictionaryJay Berkenbilt
2012-06-22Add factory methods for creating empty arrays and dictionaries.Jay Berkenbilt
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-22Use qpdf_offset_t in place of off_t in public APIs.Jay Berkenbilt
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-21Add QPDFObjectHandle::shallowCopy()Jay Berkenbilt
2012-06-20Added additional array mutatorsTobias Hoffmann
Added methods to append to arrays, insert items into arrays, and replace array contents with a vector of items.
2012-06-20ABI change: fix use of off_t, size_t, and integer typesJay Berkenbilt
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.
2011-08-10implement methods to get dictionary and array contents as map and vectorJay Berkenbilt
2010-09-24update code to new PointerHolder, and reintroduce change that was ↵Jay Berkenbilt
accidentally backed out git-svn-id: svn+q:///qpdf/trunk@1031 71b93d88-0707-0410-a8cf-f5a4172ac649
2010-08-10getRawStreamData()Jay Berkenbilt
git-svn-id: svn+q:///qpdf/trunk@1010 71b93d88-0707-0410-a8cf-f5a4172ac649
2010-08-05addPageContentsJay Berkenbilt
git-svn-id: svn+q:///qpdf/trunk@995 71b93d88-0707-0410-a8cf-f5a4172ac649
2010-08-05newStreamJay Berkenbilt
git-svn-id: svn+q:///qpdf/trunk@991 71b93d88-0707-0410-a8cf-f5a4172ac649
2010-08-05add pipeline-based stream data replacement functionJay Berkenbilt
git-svn-id: svn+q:///qpdf/trunk@990 71b93d88-0707-0410-a8cf-f5a4172ac649