Commit Graph

2680 Commits

Author SHA1 Message Date
Luis Díaz Más
a1023c39ab Add safe_op.hpp to LIBEXIV2_PRIVATE_HDR (to be shown in IDEs) 2017-12-17 20:35:07 +01:00
Dan Čermák
7c00e9128d Fix compilation error with gcc < 5
- overflow builtins were added with gcc 5.0
2017-12-17 20:35:07 +01:00
Dan Čermák
ca7c699aa1 Added overflow safe addition function 2017-12-17 20:35:07 +01:00
Robin Mills
8f5b795eaa Fixes to autotools build to respect mn_int.cpp files (#186)
* Fixes to autotools build to respect mn_int.cpp files

* Changes following Luis' code review.
2017-12-11 16:48:07 +01:00
Luis Díaz Más
f36bea3801 exiv2::getEnv throws std::out_of_range on unexpected EnVar
This change define explicitly the behavior that exiv2::getEnv should have
on response to unexpected inputs.

There are some other minor changes:

- Use _putenv_s for the unit tests on Windows
- Add todo comment
- Remove deprecated note about freeing memory
2017-12-06 17:29:05 +01:00
Luis Díaz Más
8dc3c1f0a0 Replace malloc/free by new/delete. Use const char* for input arg 2017-12-06 17:29:05 +01:00
Luis Díaz Más
bfe057ca20 Auto-formatting done by the IDE while touching code in the previous commits 2017-12-06 17:29:05 +01:00
Luis Díaz Más
8b049922d7 Change exiv2::urlencode signature to return std::string
The goal of this change is to remove the responsibility from the client code to
free the memory of the returned string.
2017-12-06 17:29:05 +01:00
Luis Díaz Más
8c010c903b Compile private part as an OBJECT library (CMake concept) 2017-11-28 17:36:08 +01:00
Luis Díaz Más
d3748152a7 add _int suffix to all the internal files 2017-11-28 17:36:08 +01:00
Luis Díaz Más
44fc9ec528 Move Cr2Header to a new .cpp file 2017-11-28 17:36:08 +01:00
Luis Diaz Mas
d48abab718 Apply clang-format to some lines of the file canonmn.cpp 2017-11-19 18:52:33 +01:00
Luis Diaz Mas
d0a1c6d19d Apply clang-format to bmpimage.cpp 2017-11-19 18:52:23 +01:00
tbeu
2efc2e79da Remove obsolete id 2017-11-19 11:17:12 +01:00
tbeu
5b5987a596 Remove obsolete EXIV2_RCSID 2017-11-19 11:17:12 +01:00
tbeu
5df8b01b77 Remove obsolete svn revision 2017-11-19 11:17:11 +01:00
Robin Mills
e96e0daa8a Jp2Image::printStructure: Corrected used DataBuf for output 2017-11-19 08:29:06 +01:00
Robin Mills
befe8c64e3 Jp2Image::printStructure: only print output when bPrint is set 2017-11-19 08:29:06 +01:00
Robin Mills
13db7fdec2 Formatting changes 2017-11-19 08:29:06 +01:00
Luis Díaz Más
87a83c89d5
Merge branch 'master' into stringFormat_update 2017-11-12 10:21:33 +01:00
Luis Díaz Más
1fe8d5ba7f Fix conversion issue detected by MSVC 2017-11-12 09:54:17 +01:00
Dan Čermák
36df4bc997 Fixed potential out of bounds file access
This commit adds a out-of-bounds protection in the case that the
extracted values for offset & count are summed up larger than the size
of the file. Also this function checks for overflows before performing
the addition.

This fixes #159
2017-11-10 15:12:55 +01:00
Dan Čermák
cfa5073a2c Added short explanation to internal function stringFormat 2017-11-09 20:38:11 +01:00
Dan Čermák
06cafadf4f Added assertion that call to vsnprintf succeeds 2017-11-09 20:38:11 +01:00
tbeu
c0ea5f4fba Rewrite the reallocation the C++ way
* Fix handling of the return value of vsnprintf
* In C++11 we could use buffer.data instead of &buffer[0]
2017-11-04 21:01:36 +01:00
tbeu
22dbd632bb Find single character 2017-11-04 21:01:36 +01:00
tbeu
d1f73aa237 Make it floats 2017-11-04 21:01:35 +01:00
tbeu
849f416771 Avoid self-assignment 2017-11-04 21:01:35 +01:00
tbeu
867343b46f Utilize const Value reference 2017-11-04 21:01:34 +01:00
tbeu
fd64d53e4b Remove superfluous variable declarations 2017-11-04 21:01:34 +01:00
tbeu
d7297a2c2c Pass argument as constant reference 2017-11-04 21:01:33 +01:00
Luis Díaz Más
4ad4323685 Add new CMake options to use compiler flags to detect issues in the code (Gcc, Clang & MSVC) 2017-11-01 05:37:54 +01:00
Andreas Sturmlechner
57883ee664
Fix build with EXIV2_BUILD_EXIV2_COMMAND=OFF 2017-10-13 18:54:11 +02:00
Dan Čermák
c686843e20 Added exception throw on Value pointer being null
v can be null if the typeId is invalid => throw an exception notifying
the user that his file is corrupted instead of the assertion
2017-10-11 09:46:04 +02:00
Dan Čermák
75940da0a6 Added check for overflows in calculation of size 2017-10-11 09:46:04 +02:00
Dan Čermák
8a586c74bb Fix for CVE-2017-14864, CVE-2017-14862 and CVE-2017-14859
The invalid memory dereference in
Exiv2::getULong()/Exiv2::StringValueBase::read()/Exiv2::DataValue::read()
is caused further up the call-stack, by
v->read(pData, size, byteOrder) in TiffReader::readTiffEntry()
passing an invalid pData pointer (pData points outside of the Tiff
file). pData can be set out of bounds in the (size > 4) branch where
baseOffset() and offset are added to pData_ without checking whether
the result is still in the file. As offset comes from an untrusted
source, an attacker can craft an arbitrarily large offset into the
file.

This commit adds a check into the problematic branch, whether the
result of the addition would be out of bounds of the Tiff
file. Furthermore the whole operation is checked for possible
overflows.
2017-10-11 09:46:04 +02:00
Dan Čermák
6c1ba331b9 Added arithmetic operation overflow error 2017-10-11 09:46:04 +02:00
Dan Čermák
ff18fec24b Fix for CVE-2017-14860
A heap buffer overflow could occur in memcpy when icc.size_ is larger
than data.size_ - pad, as then memcpy would read out of bounds of data.

This commit adds a sanity check to iccLength (= icc.size_): if it is
larger than data.size_ - pad (i.e. an overflow would be caused) an
exception is thrown.

This fixes #71.
2017-10-11 00:11:15 +02:00
Dan Čermák
65f45a3505 Added new error message to warn about corrupted metadata 2017-10-11 00:11:15 +02:00
Luis Díaz Más
4beb08e219 Merge pull request #105 from Kicer86/bigtiff
Work in progress - improvements for bigtiff
2017-10-07 09:38:49 +02:00
Luis Díaz Más
8e4aff29c2 Merge pull request #107 from D4N/tiffvisitor_nullptr_check
Use nullptr check instead of assertion, by Raphaël Hertzog
2017-10-06 15:57:55 +02:00
Michał Walenciak
2402a693fd adding missing include for numeric_limits 2017-10-06 11:27:46 +02:00
Luis Díaz Más
93bbf0cab1 Merge pull request #104 from piponazo/removeCpp11Feature
Remove cpp11 features
2017-10-06 05:40:39 +02:00
Dan Čermák
e026160556 Use nullptr check instead of assertion, by Raphaël Hertzog
Source:
https://github.com/Exiv2/exiv2/issues/57#issuecomment-333086302

tc can be a null pointer when the TIFF tag is unknown (the factory
then returns an auto_ptr(0)) => as this can happen for corrupted
files, an explicit check should be used because an assertion can be
turned of in release mode (with NDEBUG defined)

This also fixes #57
2017-10-06 00:43:31 +02:00
Luis Díaz Más
bef6dad6c5 Merge pull request #103 from AdelieLinux/master
Amend fix for #9 to apply to other Unix systems
2017-10-05 14:45:05 +02:00
Michał Walenciak
b1a5d615c5 removing debug message 2017-10-04 22:46:43 +02:00
Michał Walenciak
64e05c0a7a improving fixes for #55 and #56 2017-10-04 22:46:20 +02:00
Luis Díaz Más
1a1a61b63d Remove reference to regex & c++11 from the man page 2017-10-04 19:42:11 +02:00
Luis Díaz Más
5b8894908b Remove all references to EXV_HAVE_REGEX and related code 2017-10-04 19:27:01 +02:00
Luis Díaz Más
bfd61bd0f1 Merge pull request #96 from Kicer86/master
Adding comment for issue #56
2017-10-04 09:27:54 +02:00