aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDF_linearization.cc
AgeCommit message (Collapse)Author
2023-12-20Bug fix: don't compress hint streams when --compress-streams=nJay Berkenbilt
2023-10-15Write offsets as unsigned in linearization hint tables (fixes #1023)Jay Berkenbilt
2023-06-09Code tidy - Clang-Tidy rule modernize-use-emplacem-holger
2023-05-27Code tidy - reflow comments and stringsm-holger
2023-05-21Rerun clang-formatJay Berkenbilt
2023-05-21Replace 'this->m' with 'm'm-holger
Manual edits for cases not handled by search and replace
2023-05-21Globally replace 'this->m->' with 'm->'m-holger
Using search and replace.
2023-05-20Replace deprecated C++ includesm-holger
2023-05-20Remove unused include directivesm-holger
2023-02-19Handle linearization warnings as proper warning (fixes #851)Jay Berkenbilt
2022-11-20Add methods QPDFTokenizer::Token::isWordm-holger
2022-11-20Add method QPDFTokenizer::Token::isIntegerm-holger
2022-11-19Correctly handle reuse of xref stream (fixes #809)Jay Berkenbilt
2022-10-01Code tidy: use QPDF::toS and QPDF::toI where possiblem-holger
2022-10-01Add private methods QPDF::damagedPDFm-holger
2022-09-21Replace calls to QUtil::int_to_string with std::to_stringm-holger
2022-08-31Replace calls to QPDFObjectHandle::Factory::newIndirect where possiblem-holger
2022-08-01Add QPDF::getObject to replace getObjectByObjGen and getObjectByIDm-holger
For consistency with similar methods, e.g. replaceObject.
2022-07-26Code tidy : replace 0 with nullptr or truem-holger
2022-07-24Revert making second parameter of QPDFObjGen::QPDFObjGen optionalm-holger
Also, change test for QPDFObjGen::isIndirect to obj != 0. Delete comment from commit afd35f9.
2022-07-24QPDFObjGen : tidy QPDF private methodsm-holger
Change method signatures to use QPDFObjGen. Use QPDFObjGen methods where possible. Remove redundant QPDF::objGenToIndirect.
2022-07-24QPDFObjGen : tidy QPDFObjectHandle private methodsm-holger
Change method signature to use QPDFObjGen.
2022-07-24QPPFObjGen : tidy QPDF::readObjectAtOffsetm-holger
Change method signature to use QPDFObjGen.
2022-07-24Clarify intent in readObjectAtOffsetJay Berkenbilt
Rather than using object id -1 to mean "don't care", use object ID 0, and clarify the difference between that use and indication of a direct object.
2022-06-18QPDF, QPDFJob: use QPDFLogger instead of custom output streamsJay Berkenbilt
2022-05-21Code clean up: use range-style for loops wherever possiblem-holger
Remove variables obsoleted by commit 4f24617.
2022-05-04Remove remaining incorrect assert calls from implementationJay Berkenbilt
2022-04-30Code clean up: use range-style for loops wherever possibleJay Berkenbilt
Where not possible, use "auto" to get the iterator type. Editorial note: I have avoid this change for a long time because of not wanting to make gratuitous changes to version history, which can obscure when certain changes were made, but with having recently touched every single file to apply automatic code formatting and with making several broad changes to the API, I decided it was time to take the plunge and get rid of the older (pre-C++11) verbose iterator syntax. The new code is just easier to read and understand, and in many cases, it will be more effecient as fewer temporary copies are being made. m-holger, if you're reading, you can see that I've finally come around. :-)
2022-04-09Replace PointerHolder with std::shared_ptr in library sources onlyJay Berkenbilt
(patrepl and cleanpatch are my own utilities) patrepl s/PointerHolder/std::shared_ptr/g {include,libqpdf}/qpdf/*.hh patrepl s/PointerHolder/std::shared_ptr/g libqpdf/*.cc patrepl s/make_pointer_holder/std::make_shared/g libqpdf/*.cc patrepl s/make_array_pointer_holder/QUtil::make_shared_array/g libqpdf/*.cc patrepl s,qpdf/std::shared_ptr,qpdf/PointerHolder, **/*.cc **/*.hh git restore include/qpdf/PointerHolder.hh cleanpatch ./format-code
2022-04-04Programmatically apply new formatting to codeJay Berkenbilt
Run this: for i in **/*.cc **/*.c **/*.h **/*.hh; do clang-format < $i >| $i.new && mv $i.new $i done
2022-02-08WHITESPACE ONLY -- expand tabs in source codeJay Berkenbilt
This comment expands all tabs using an 8-character tab-width. You should ignore this commit when using git blame or use git blame -w. In the early days, I used to use tabs where possible for indentation, since emacs did this automatically. In recent years, I have switched to only using spaces, which means qpdf source code has been a mixture of spaces and tabs. I have avoided cleaning this up because of not wanting gratuitous whitespaces change to cloud the output of git blame, but I changed my mind after discussing with users who view qpdf source code in editors/IDEs that have other tab widths by default and in light of the fact that I am planning to start applying automatic code formatting soon.
2022-02-07Update for clean compile with POINTERHOLDER_TRANSITION=2Jay Berkenbilt
2022-02-07Replace PointerHolder arrays with shared_ptr arrays where possibleJay Berkenbilt
Replace PointerHolder arrays wherever it can be done without breaking ABI.
2022-02-04PointerHolder: deprecate getPointer() and getRefcount()Jay Berkenbilt
Use get() and use_count() instead. Add #define NO_POINTERHOLDER_DEPRECATION to remove deprecation markers for these only. This commit also removes all deprecated PointerHolder API calls from qpdf's code except in PointerHolder's test suite, which must continue to test the deprecated APIs.
2021-12-10Handle bitstream overflow errors more gracefully (fixes #581)Jay Berkenbilt
* Make it a runtime error, not a logic error * Include additional information * Capture it properly in checkLinearization
2020-04-29Write linearization errors to stderr (fixes #438)Jay Berkenbilt
2020-04-16Fix warnings reported by -Wshadow=local (fixes #431)Jay Berkenbilt
2019-06-25Convert previously overlooked static cast to QIntCJay Berkenbilt
2019-06-23Treat all linearization errors as warningsJay Berkenbilt
This also reverts the addition of a new checkLinearization that distinguishes errors from warnings. There's no practical distinction between what was considered an error and what was considered a warning.
2019-06-22qpdf: exit 3 for linearization warnings without errors (fixes #50)Jay Berkenbilt
2019-06-21Fix bugs found by fuzz testsJay Berkenbilt
* Several assertions in linearization were not always true; change them to run time errors * Handle a few cases of uninitialized objects * Handle pages with no contents when doing form operations * Handle invalid page tree nodes when traversing pages
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-01-07Fix integer overflow in large file testJay 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.
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.
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-11Find lindict without PCREJay Berkenbilt
2017-08-11Implement findFirst and findLast in InputSourceJay Berkenbilt
Preparing to refactor some pattern searching code to use these instead of their own memchr loops. This should simplify the code that replaces PCRE.
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.