-
- Standardize error handling by replacing repetitive throw statements with helper functions. - Add test coverage for new helper functions in error handling. - Enhance maintainability and readability with concise utilities.
-
The PDF spec only allows UTF-16BE, but most readers seem to accept UTF-16LE as well, so now qpdf does too.
-
There are codepoints in PDFDoc that are not valid UTF-8 but map to valid UTF-8. We were handling those correctly with bidirectional mapping. However, if those same code points appeared in UTF-8, where they have no meaning, they were left as fixed points when converting to PDFDoc, where they do have meaning. This change recognizes them as errors.
-
* Use unique_ptr in place of shared_ptr in some cases * unique_ptr for arrays does not require a custom deleter * use std::make_unique (c++14) where possible
-
Replace most of the calls to QUtil::copy_string with this instead.
-
This code was essentially duplicated between test_driver and standalone_fuzz_target_runner.
-
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.
-
fopen was previuosly called wrapped by QUtil::fopen_wrapper, but QUtil::safe_fopen does this itself, which is less cumbersome.
-
Remove needless calls to open, close, and fileno; call remove instead of unlink.
-
Make them safer by avoiding any internal limits and replacing sprintf with std::ostringstream.
-
git-svn-id: svn+q:///qpdf/trunk@709 71b93d88-0707-0410-a8cf-f5a4172ac649