Commit Graph

69 Commits

Author SHA1 Message Date
Jay Berkenbilt b4bdc42b4f New exception class QPDFSystemError (fixes #221) 2018-08-13 20:01:51 -04:00
Jay Berkenbilt a2f62935b3 Catch exceptions as const references (fixes #236)
This fix allows qpdf to compile/test cleanly with gcc 8.
2018-08-12 21:57:52 -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 3fe5236d54 Fix typo 2018-06-22 19:28:18 -04:00
Jay Berkenbilt c543c1e4e5 Windows test workaround 2018-06-22 17:19:34 -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 e44c395c51 QUtil::toUTF16 2018-06-21 15:57:13 -04:00
Jay Berkenbilt 44674a3e58 Label qutil test output 2018-06-21 15:57:13 -04:00
Jay Berkenbilt b096e99649 buffer test: fix memory leak in test code
Forgot to delete a buffer in the test driver. There was no memory leak
or memory error in any installed code.
2018-05-05 17:43:44 -04:00
Jay Berkenbilt 1a4dcb4aaf Pl_Buffer starts in a ready state 2018-03-06 11:31:03 -05:00
Jay Berkenbilt 95ba7125ff Fix link order (fixes #176)
Specify qpdf libraries before external ones.
Specify LDFLAGS before libraries.
This should eliminate remaining cases of qpdf builds favoring
previously installed versions.
2018-02-04 14:19:00 -05:00
Jay Berkenbilt 3e306ae64c Add QUtil::hex_decode 2018-01-14 09:04:13 -05:00
Jay Berkenbilt 6299c64cf3 Use correct link directory order (fixes #158)
Make sure to link from the source tree before linking from the system.
In many environments, this is necessary to allow a newly built qpdf to
link properly instead of trying to link or resolve libraries from an
older installed version.
2018-01-13 19:53:52 -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 bf2fb239d7 Rename png_filter -> predictors 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 38bdbc0719 PNG filter test images 2017-12-25 14:24:48 -05:00
Jay Berkenbilt a3a55be9cd Correct errors in PNG filters and make use from library 2017-12-25 14:24:48 -05: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 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 6d46346eb9 Detect integer overflow/underflow 2017-08-29 12:28:32 -04:00
Jay Berkenbilt caf5e39c2e Fix compiler warnings for clang/mac OS X 2017-08-22 14:13:10 -04:00
Jay Berkenbilt ae90d2c485 Implement Pl_DCT pipeline
Additional testing is added in later commits to be supported by
additional changes in the library.
2017-08-21 17:44:02 -04:00
Jay Berkenbilt 2d2f619665 Implement Pl_RunLength pipeline 2017-08-19 14:50:55 -04:00
Jay Berkenbilt 9a96e233b0 Remove PCRE 2017-08-10 21:30:32 -04:00
Jay Berkenbilt 296b679d6e Implement findFirst and findLast in InputSource
Preparing to refactor some pattern searching code to use these instead
of their own memchr loops. This should simplify the code that replaces
PCRE.
2017-08-10 21:30:32 -04:00
Jay Berkenbilt 2d5b854468 Allow reading command-line args from files (fixes #16) 2017-07-29 22:23:21 -04:00
Jay Berkenbilt 5993c3e83c Detect input file = output file (fixes #29) 2017-07-29 20:58:01 -04:00
Thorsten Schöning bfb9341310 Use RM_WS_ONLY_LINES in test
Some compilers output extra newlines in some cases.
2016-01-24 12:05:22 -05:00
Thorsten Schöning 953e6f641f Include stdlib.h to provide exit 2016-01-24 12:05:02 -05:00
Jay Berkenbilt b8bdef0ad1 Implement deterministic ID
For non-encrypted files, determinstic ID generation uses file contents
instead of timestamp and file name. At a small runtime cost, this
enables generation of the same /ID if the same inputs are converted in
the same way multiple times.
2015-10-31 18:56:42 -04:00
Jay Berkenbilt 6067608d93 Remove needless #ifdef _WIN32 from getWhoami 2013-12-16 16:21:28 -05:00
Jay Berkenbilt 235d8f28f8 Increase random data provider support
Add a method to get the current random data provider, and document and
test the method for resetting it.
2013-12-16 16:21:28 -05:00
Jay Berkenbilt 30287d2d65 Allow OS-provided secure random to be disabled 2013-12-14 15:17:36 -05:00
Jay Berkenbilt 5e3bad2f86 Refactor random data generation
Add new RandomDataProvider object and implement existing random number
generation in terms of that.  This enables end users to supply their
own random data providers.
2013-12-14 15:17:35 -05:00
Jay Berkenbilt 212812d837 Fix errors reported by Coverity
Thanks to Jiri Popelka from Red Hat for sending the output of a
Coverity run over qpdf.
2013-07-07 15:36:51 -04:00
Jay Berkenbilt ac4deac187 Call QUtil::safe_fopen in place of fopen
fopen was previuosly called wrapped by QUtil::fopen_wrapper, but
QUtil::safe_fopen does this itself, which is less cumbersome.
2013-03-05 13:35:46 -05:00
Jay Berkenbilt a51ae10b8d Remove all calls to sprintf 2013-03-05 13:35:46 -05:00
Jay Berkenbilt 66c3c8fdf7 Use portable versions of some UNIX-specific calls
Remove needless calls to open, close, and fileno; call remove instead
of unlink.
2013-03-05 13:35:46 -05:00
Jay Berkenbilt 6b9297882e Mark secure CRT warnings with comment
Put a specific comment marker next to every piece of code that MSVC
gives warning 4996 for.  This warning is generated for calls to
functions that Microsoft considers insecure or deprecated.  This
change is in preparation for fixing all these cases even though none
of them are actually incorrect or insecure as used in qpdf.  The
comment marker makes them easier to find so they can be fixed in
subsequent commits.
2013-03-05 13:33:32 -05:00
Jay Berkenbilt 8be8277613 Rewrite QUtil::int_to_string and QUtil::double_to_string
Make them safer by avoiding any internal limits and replacing sprintf
with std::ostringstream.
2013-03-04 16:45:16 -05:00
Jay Berkenbilt ed19516aa7 Fix unused local variable warnings 2013-03-04 16:45:16 -05:00
Jay Berkenbilt 30027481f7 Remove all old-style casts from C++ code 2013-03-04 16:45:16 -05:00
Jay Berkenbilt 0873e42300 SHA2 pipeline with support for 256, 384, and 512 bits
Implemented pipeline around sph sha calls using standard test vectors
for full-byte values.  Did not test or support partial byte values.
2012-12-31 05:36:51 -05:00
Jay Berkenbilt 9b42f526df Update AES classes to work with 256-bit keys 2012-12-31 05:36:50 -05:00
Jay Berkenbilt d6cb2b9418 Add test code for Pl_Concatenate 2012-06-27 10:20:47 -04:00
Jay Berkenbilt 5d4cad9c02 ABI change: fix use of off_t, size_t, and integer types
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.
2012-06-20 15:20:26 -04:00
Jay Berkenbilt 81fc594342 Remove extraneous execute bits 2012-06-20 15:18:08 -04:00
Jay Berkenbilt 76b1659177 enhance PointerHolder so that it can explicitly be told to use delete [] instead of delete, thus making it useful to run valgrind over qpdf during its test suite 2011-08-11 11:57:37 -04:00