aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QUtil.cc
AgeCommit message (Collapse)Author
2019-11-09Allow odd/even modifiers in numeric range (fixes #364)Jay Berkenbilt
2019-08-31Add remove_file and rename_file to QUtilJay Berkenbilt
2019-06-22In shippable code, favor smart pointers (fixes #235)Jay Berkenbilt
Use PointerHolder in several places where manually memory allocation and deallocation were being used. This helps to protect against memory leaks when exceptions are thrown in surprising places.
2019-06-22Add QUtil::read_file_into_memoryJay Berkenbilt
This code was essentially duplicated between test_driver and standalone_fuzz_target_runner.
2019-06-22Rename QUtil::strcasecmp to QUtil::str_compare_nocase (fixes #242)Jay Berkenbilt
2019-06-21Fix bounds error in utf16_to_utf8 conversionJay Berkenbilt
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-21QUtil: add unsigned int/string functionsJay Berkenbilt
2019-05-16Fix Windows memory error (fixes #330)Jay Berkenbilt
2019-04-21Support Unicode in filenames (fixes #298)Jay Berkenbilt
2019-03-11"_setmode" and "_stricmp" are not available on Borland C++Builder, neither ↵Thorsten Schöning
the classic one nor newer ones based on CLANG.
2019-01-17Add QUtil::possible_repaired_encodingsJay Berkenbilt
2019-01-17Add status-reporting transcoders to QUtilJay Berkenbilt
2019-01-17QUtil::analyze_encodingJay Berkenbilt
2019-01-17Bidirectional transcoding for win, mac, pdf, utf8, utf16Jay Berkenbilt
2019-01-17Move remaining existing transcoding to QUtilJay Berkenbilt
2019-01-11Add configure option AVOID_WINDOWS_HANDLEJay Berkenbilt
If set, we avoid using Windows I/O HANDLE, which is disallowed in some versions of the Windows SDK, such as for Windows phones. QUtil::same_file will always return false in this case. Only applies to Windows builds.
2019-01-06Add WinAnsi and MacRoman encodingJay Berkenbilt
2019-01-06Refactor QUtil::utf8_to_asciiJay Berkenbilt
2019-01-06Move utf8_to_utf16 into QUtilJay Berkenbilt
2019-01-04Add QUtil::utf8_to_asciiJay Berkenbilt
2018-12-22Move numrange code from qpdf.cc to QUtil.ccJay Berkenbilt
Also move tests to libtests.
2018-08-14New exception class QPDFSystemError (fixes #221)Jay Berkenbilt
2018-06-21QUtil::toUTF16Jay Berkenbilt
2018-02-04Fix setLineBuf for bsd (fixes #177)Jay Berkenbilt
Use 0 instead of NULL in a cast.
2018-01-15Fixes for clangJay Berkenbilt
2018-01-14Add QUtil::hex_decodeJay Berkenbilt
2018-01-14Allow trailing . in numeric token (fixes #165)Jay Berkenbilt
2017-08-29Detect integer overflow/underflowJay Berkenbilt
2017-08-11Find xref without PCREJay Berkenbilt
2017-08-05QUtil::strcasecmpJay Berkenbilt
2017-07-30Allow reading command-line args from files (fixes #16)Jay Berkenbilt
2017-07-30Detect input file = output file (fixes #29)Jay Berkenbilt
2017-07-27Move lexer helper functions to QUtilJay Berkenbilt
2017-07-26Make windows includes lowercase (fixes #123)slurdge
For cross compiling.
2016-01-24C++-Builder supports 64 Bit file functionsThorsten Schöning
The 64 Bit file functions are supported by C++-Builder as well and need to be used, else fseek will error out on larger files than 4 GB like used in the large file test.
2013-12-16Remove needless #ifdef _WIN32 from getWhoamiJay Berkenbilt
2013-12-16Increase random data provider supportJay Berkenbilt
Add a method to get the current random data provider, and document and test the method for resetting it.
2013-12-14Refactor random data generationJay Berkenbilt
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-11-30Allow -DNO_GET_ENVIRONMENT to avoid GetEnvironmentVariableJay Berkenbilt
If NO_GET_ENVIRONMENT is #defined at compile time on Windows, do not call GetEnvironmentVariable. QUtil::get_env will always return false. This option is not available through configure. This was added to support a specific user's requirements to avoid calling GetEnvironmentVariable from the Windows API. Nothing in qpdf outside the test coverage system in qtest relies on QUtil::get_env.
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-10-18Security: use a secure random number generatorJay Berkenbilt
If not available, give an error. The user may also configure qpdf to use an insecure random number generator.
2013-10-10Security: keep cur_byte pointing into bytes arrayJay Berkenbilt
2013-04-14Run spelling checkerJay Berkenbilt
2013-03-05Favor strerror_s and fopen_s on MSVCJay Berkenbilt
Make remaining calls to fopen and strerror use strerror_s and fopen_s on MSVC.
2013-03-05Call QUtil::safe_fopen in place of fopenJay Berkenbilt
fopen was previuosly called wrapped by QUtil::fopen_wrapper, but QUtil::safe_fopen does this itself, which is less cumbersome.
2013-03-05Remove all calls to sprintfJay Berkenbilt
2013-03-05Mark secure CRT warnings with commentJay Berkenbilt
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-04Rewrite QUtil::int_to_string and QUtil::double_to_stringJay Berkenbilt
Make them safer by avoiding any internal limits and replacing sprintf with std::ostringstream.
2013-03-04Remove all old-style casts from C++ codeJay Berkenbilt