2833 Commits (dba48ac3d9454096e7afaa653cb510490c4fb8d2)

Author SHA1 Message Date
Dan Čermák 5e36363138 Fix double promotion issues 7 years ago
Dan Čermák bc58752d18 Remove useless casts
This commit removes only casts where type A is cast to the exactly same
type (and not to a platform dependent typedefs)
7 years ago
Dan Čermák bb2019149a [safe_op] Don't use overflow intrinsics in MSVC 2005 7 years ago
Luis Díaz Más e32323d7c7 Simplify usage of strerror_r.
- Define STRERROR_R_CHAR_P properly on CMake and use it on futils.cpp
- We use now _GNU_SOURCE to determine which version of strerror_r to use
- strError only throws if ret==ERANGE
- Remove STRERROR_R_CHAR_P. It has been never used
- sort defines in config.h.cmake
- Remove EXV_HAVE_DECL_STRERROR_R that is not used anymore
- Remove EXV_HAVE_STRERROR. C++98 always will have it
7 years ago
Robin Mills d22fff4834 Lens Recognition for Tamron SP AF 150-600mm F/5-6.3 VC USD G2 (A022) for Nikon
http://dev.exiv2.org/issues/1348
7 years ago
Luis Díaz Más f86542e5f6 Remove EXV_HAVE_STRTOL 7 years ago
Luis Díaz Más d55b2b1b65 Remove HAVE_STDLIB_H check and replace stdlib.h by cstdlib 7 years ago
Luis Díaz Más aded1965c5 Remove EXV_HAVE_MEMSET 7 years ago
Luis Díaz Más abd28a6a9e Remove EXV_HAVE_STRCHR 7 years ago
Dan Čermák fc60d97a29 Prevent passing of null-pointers to libc functions 7 years ago
Dan Čermák 2bf89f4854 Store pointers to Impl classes in auto_ptr
Pimpl class Impl is stored in raw pointers which are allocated on the heap in
the constructor. However, the constructor can throw an exception resulting in a
memory leak as the destructor is **not** invoked.
=> A smart pointer is however properly deallocated.
7 years ago
Luis Díaz Más 02aa13abf3 Install conan-dependencies DLLs into install/bin.
We also changed the way in which we copy the DLLs to the bin folder inside the build directory.
Before we were directly placing the conan-deps DLLs into the bin folder directly. Now we place
them into a directory called conanDlls, and from there we copy them to bin or install/bin
at build and install steps respectively.
7 years ago
Luis Díaz Más fbd8e2669e sort alphabetically the sources in src/CMakelists.txt 7 years ago
Luis Díaz Más de5b9ebf89 Remove duplication of sources in src/CMakeLists.txt 7 years ago
Luis Díaz Más ffbcaa2e6d Fix MSVC warning C4267: conversion from 'size_t' to 'long' 7 years ago
Luis Díaz Más bd40c18f1c Use variable in TimeValue::copy to remove -Wunused-variable warning 7 years ago
Luis Diaz Mas a246c73d6f Use unused variable instead of hard-coded values in DateValue::copy 7 years ago
Luis Díaz Más bf7047a71b clang-format XmpKey code 7 years ago
Luis Diaz Mas 07d75cd0e8 Check if ExifData::findKey return valid iterators 7 years ago
Luis Díaz Más 858c99b4df Add enforce before calling REPORT_MARKER with invalid marker 7 years ago
Luis Díaz Más 5e5d76ad0a clang format function 7 years ago
Dan Čermák 3c20cc06a9 Fix CVE-2017-1000126
CVE-2017-1000126 is a Stack out of bounds read in the WebP parser caused by the
parameter size & filesize being too large, causing the parser to land in an
infinite loop and eventually crash. Enforcing that the size over which the
parser iterates is smaller than the file fixes this issue.

This fixes #175.
7 years ago
Dan Čermák 49db96cd58 [webp] Fix wrong filesize parameter being extracted from the header
The webp header contains the filesize of the image starting at the 8th byte in
bytes 4 to 8 encoded as a little endian 32 bit unsigned integer. The code was
erroneously assuming that the extracted filesize is starting at the 12th byte,
i.e. at the end of the WebP file header.

Source: https://developers.google.com/speed/webp/docs/riff_container
7 years ago
Dan Čermák 5de9a7b562 Add a port of enforce() from D
enforce is a function comparable to assert(), it ensures that a condition is
true. However, while assert() should be used for conditions where we can be
certain that they are true, enforce is intended to be used for conditions that
can fail (like on invalid input). Therefore enforce() throws an exception when
the condition is false and does not abort the program's execution. Also, it is
not turned off by defining NDEBUG.

- add a new file enforce.hpp
- implement enforce()
7 years ago
HumanDynamo 22a0b32c01 Fix typo of Xmp.video.AspectRatio's value type 7 years ago
Luis Díaz Más 01a5d863ad Apply clang-format to Print::printMetadatum 7 years ago
Luis Díaz Más 45fe44aa2f Move condition in if statement to discard work earlier 7 years ago
Luis Díaz Más d82b9434e1 Only print items (Params::prValue) when size > 0 7 years ago
Robin Mills 185d0e9482 #199 Fix for getopt(). Use src/getopt_win32 code instead of libc/getopt() 7 years ago
Dan Čermák 06ec1e6984 [safe_op] Refactored addition overflow checks using functions only
- templated structs were not required, SFINAE works for functions too
  => use instead, removes some unneeded code
- fix non-usage of builtins with clang
- adjust unit tests
7 years ago
Dan Čermák 684c8c89de [safe_op] Simplified unsigned int overflow check
Simply check for overflows after the addition, as no undefined behavior can
occur here.
7 years ago
Dan Čermák 31b96b58e7 [safe_op] improved signed int overflow checks via integer promotion
The fallback signed integer overflow check is quite expensive, but the addition
can be safely performed when saved in an int due to integer promotion
rules. This makes the check a little less expensive.
7 years ago
Dan Čermák 029b997ca0 [safe_op] fixed typo in doc-comment 7 years ago
Dan Čermák 751fba8b54 Added dataBuf size check before calling PngChunk::decodeIHDRChunk
- cdataBuf must be at least 8 bytes long otherwise decodeIHDRChunk
  reads out of bounds
- pngImage::readMetadata now skips png chunks where the offset for
  IHDR chunks is invalid
- added assertion into PngChunk::decodeIHDRChunk() to ensure dataBuf
  size
7 years ago
Fredrik lingvall fc8b45dd12 Added the Sigma 120-300mm F2.8 DG OS HSM | S for Nikon mount. 7 years ago
Fredrik lingvall 34a3be025e Added Sigma 50mm F1.4 DG HSM | A mount/UPC code (for Nikon mount). 7 years ago
Fredrik Lingvall 215227024d Added Sigma 20mm F1.4 DG HSM | A mount/UPC code (for Nikon mount). 7 years ago
Dan Čermák efe2ccdcb6 Replaced all hardcoded error codes with ker... constants 7 years ago
Dan Čermák d3c3c036b8 Incorporated error codes into errList 7 years ago
Robin Mills 55001c8ddf
Merge pull request #222 from Exiv2/fix-220
Fix 220
7 years ago
Dan Čermák fcb4257051 Add check for DataBuf.size_ in Jp2Image::readMetadata()
When parsing a subBox that is a ColorHeader, a length is extracted
from the input file and fed directly into DataBuf() (which calls
malloc). A crafted input file can provide arbitrarily (up to
max(uint32_t)-8) large values and result in excessive memory
allocation.

This commit adds a check for the new size of DataBuf so that it is not
larger than the remaining size of the file.

This fixes #202 aka CVE-2018-4868
7 years ago
Robin Mills a1f1989cb5
Merge branch 'master' into master 7 years ago
clanmills c082537967 Fix #220 https://github.com/Exiv2/exiv2/issues/220 8 years ago
Dan Čermák 4429b962e1 Fix out of bounds read in src/pngchunk_int.cpp by @brianmay
- consider that key is advanced by 8 bytes if stripHeader is true
  => length is reduced by same amount
  Fixed by adding offset to the check in the loop
- Rewrote loop so that keysize is checked before the next
  iteration (preventing an out of bounds read)
8 years ago
Robin Mills df4113b765 changes to MemIo::reserve() for #200 (#213)
* changes to MemIo::reserve() for #200

* Changes following review by Dan (thanks, Dan).
8 years ago
Michał Walenciak d219e61586 be more error prone 8 years ago
Michał Walenciak 24348e85ca checks for valid reads 8 years ago
Michał Walenciak 421c6d6723 improvements for issue #208 8 years ago
Michał Walenciak 1647908e00 fix for crash in bigtiff (issue #208) 8 years ago
Robin Mills 7d42da94d0 Removed wrong ExifData::const_iterator that shadowed the correct one 8 years ago
Luis Díaz Más 00f32316b2 Add missing header 8 years ago
Luis Díaz Más 14ff034fb4 Catch std::overflow_error exception in Print::run 8 years ago
Luis Diaz Mas d09c4bb7cd Fix arithmetic operation overflow 8 years ago
Luis Díaz Más a1023c39ab Add safe_op.hpp to LIBEXIV2_PRIVATE_HDR (to be shown in IDEs) 8 years ago
Dan Čermák 7c00e9128d Fix compilation error with gcc < 5
- overflow builtins were added with gcc 5.0
8 years ago
Dan Čermák ca7c699aa1 Added overflow safe addition function 8 years ago
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.
8 years ago
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
8 years ago
Luis Díaz Más 8dc3c1f0a0 Replace malloc/free by new/delete. Use const char* for input arg 8 years ago
Luis Díaz Más bfe057ca20 Auto-formatting done by the IDE while touching code in the previous commits 8 years ago
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.
8 years ago
Luis Díaz Más 8c010c903b Compile private part as an OBJECT library (CMake concept) 8 years ago
Luis Díaz Más d3748152a7 add _int suffix to all the internal files 8 years ago
Luis Díaz Más 44fc9ec528 Move Cr2Header to a new .cpp file 8 years ago
Luis Diaz Mas d48abab718 Apply clang-format to some lines of the file canonmn.cpp 8 years ago
Luis Diaz Mas d0a1c6d19d Apply clang-format to bmpimage.cpp 8 years ago
tbeu 2efc2e79da Remove obsolete id 8 years ago
tbeu 5b5987a596 Remove obsolete EXIV2_RCSID 8 years ago
tbeu 5df8b01b77 Remove obsolete svn revision 8 years ago
Robin Mills e96e0daa8a Jp2Image::printStructure: Corrected used DataBuf for output 8 years ago
Robin Mills befe8c64e3 Jp2Image::printStructure: only print output when bPrint is set 8 years ago
Robin Mills 13db7fdec2 Formatting changes 8 years ago
Luis Díaz Más 87a83c89d5
Merge branch 'master' into stringFormat_update 8 years ago
Luis Díaz Más 1fe8d5ba7f Fix conversion issue detected by MSVC 8 years ago
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
8 years ago
Dan Čermák cfa5073a2c Added short explanation to internal function stringFormat 8 years ago
Dan Čermák 06cafadf4f Added assertion that call to vsnprintf succeeds 8 years ago
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]
8 years ago
tbeu 22dbd632bb Find single character 8 years ago
tbeu d1f73aa237 Make it floats 8 years ago
tbeu 849f416771 Avoid self-assignment 8 years ago
tbeu 867343b46f Utilize const Value reference 8 years ago
tbeu fd64d53e4b Remove superfluous variable declarations 8 years ago
tbeu d7297a2c2c Pass argument as constant reference 8 years ago
Luis Díaz Más 4ad4323685 Add new CMake options to use compiler flags to detect issues in the code (Gcc, Clang & MSVC) 8 years ago
Andreas Sturmlechner 57883ee664
Fix build with EXIV2_BUILD_EXIV2_COMMAND=OFF 8 years ago
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
8 years ago
Dan Čermák 75940da0a6 Added check for overflows in calculation of size 8 years ago
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.
8 years ago
Dan Čermák 6c1ba331b9 Added arithmetic operation overflow error 8 years ago
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.
8 years ago
Dan Čermák 65f45a3505 Added new error message to warn about corrupted metadata 8 years ago
Luis Díaz Más 4beb08e219 Merge pull request #105 from Kicer86/bigtiff
Work in progress - improvements for bigtiff
8 years ago
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
8 years ago
Michał Walenciak 2402a693fd adding missing include for numeric_limits 8 years ago
Luis Díaz Más 93bbf0cab1 Merge pull request #104 from piponazo/removeCpp11Feature
Remove cpp11 features
8 years ago
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
8 years ago
Luis Díaz Más bef6dad6c5 Merge pull request #103 from AdelieLinux/master
Amend fix for #9 to apply to other Unix systems
8 years ago
Michał Walenciak b1a5d615c5 removing debug message 8 years ago
Michał Walenciak 64e05c0a7a improving fixes for #55 and #56 8 years ago
Luis Díaz Más 1a1a61b63d Remove reference to regex & c++11 from the man page 8 years ago
Luis Díaz Más 5b8894908b Remove all references to EXV_HAVE_REGEX and related code 8 years ago
Luis Díaz Más bfd61bd0f1 Merge pull request #96 from Kicer86/master
Adding comment for issue #56
8 years ago
A. Wilcox d775683f57
Amend fix for #9 to apply to other Unix systems
At least the musl libc on Linux has the same issue as Mac OS X: the
PTHREAD_RECURSIVE_* static initialiser does not exist.  This is a
documented and purposeful omission:

http://www.openwall.com/lists/musl/2017/02/20/3

This commit uses similar logic to the Apple test on other Unixes.
8 years ago
Luis Diaz Mas 2784b1f7f7 Remove EXIV2_ENABLE_LIBXMP variable, always build static XMP library, remove cmake OBJECT library 8 years ago
Michał Walenciak 7e90668011 Adding comment for issue #56 8 years ago
Luis Díaz Más df3c77516c Merge pull request #94 from piponazo/configFileInBuildDirectory
Generate exv_conf.h file out of the source tree.
8 years ago
Luis Díaz Más a9e3f17f31 Generate exv_conf.h file out of the source tree. Install it in the include folder. 8 years ago
Luis Díaz Más 686edde5ef Provide exiv2Config file automatically generated by CMake 8 years ago
clanmills 327b3f6c4d Fix https://github.com/Exiv2/exiv2/issues/83 8 years ago
Robin Mills 2f0104879a Merge pull request #81 from piponazo/robinChanges
Robin changes
8 years ago
clanmills d43cd82002 Fix #80 8 years ago
Luis Díaz Más 8ad49f6d73 Robin changes in sync with master changes 8 years ago
Dan Čermák 74cb5bab13 Fixed wrong brackets: size*count + pad can overflow before the cast
=> Should fix #76 (most of the work has been done by Robin Mills in
   6e3855aed7)

The problem with #76 is the contents of the 26th IFD, with the
following contents:
tag: 0x8649
type: 0x1
count: 0xffff ffff
offset: 0x4974

The issue is the size of count (uint32_t), as adding anything to it
causes an overflow. Especially the expression:
(size*count + pad+20)
results in an overflow and gives 20 as a result instead of
0x100000014, thus the condition in the if in the next line is false
and the program continues to run (until it crashes at io.read).

To properly account for the overflow, the brackets have to be removed,
as then the result is saved in the correctly sized type and not cast
after being calculated in the smaller type.

The brackets have also been removed from bigtiffimage.cpp, where the
same issue is present.
8 years ago
Robin Mills d8ae4484ae msvc support for bigtiffimage.cpp 8 years ago
Robin Mills e1948c7ff9 msvc/bigtiffimage support 8 years ago
clanmills 6e3855aed7 Fix https://github.com/Exiv2/exiv2/issues/55 8 years ago
Robin Mills 197375dfa4 Merge pull request #72 from Kicer86/bigtiff
Some improvements, crash fix.
8 years ago
Michał Walenciak 9acc1c56a7 adding ifd8 and long longs to is8ByteType() 8 years ago
Michał Walenciak 4837d8cf58 changing header + some warning fix 8 years ago
Robin Mills 6fd0bc9e10 Adding ./configure support for bigtiffimage.cpp 8 years ago
clanmills 678e2b8517 Explicitly list files to be processed CMake generated builds [remove file(GLOB...)] 8 years ago
Michał Walenciak 734a2c3d57 fixing TODO 8 years ago
Michał Walenciak e3ff1ba694 fixing indent 8 years ago
Michał Walenciak 4629227358 fix for IPTCNAA
dir_offset was used instead of offset
8 years ago
Michał Walenciak 4f6f5b4946 removing conditional_byte_swap* functions 8 years ago
Michał Walenciak b6e79357de Adding 8-byte swap functions + consts 8 years ago
Michał Walenciak f96d84ba8c dropping dead code 8 years ago
Michał Walenciak 50ecf672b5 using Internal::indent() 8 years ago
Michał Walenciak f8ac7a5dc3 renaming Tiff to StandardTiff 8 years ago
Michał Walenciak d460bbdb3f fix for standard tiff case 8 years ago
Michał Walenciak 81aa8828e0 applying dff941ad7f 8 years ago
Michał Walenciak 874daede53 fixing broken print for 'offset' column 8 years ago
Michał Walenciak 8b07982bf2 variable names cleanup 8 years ago
Michał Walenciak 1a1dc3afd4 simplifying code 8 years ago
Michał Walenciak c6cbf69c49 first attempt to read both - standard and big tiff 8 years ago
Michał Walenciak 972e302cba some cleanups 8 years ago
Michał Walenciak 3c9817339a Dropping BasicIo& io parameter.
We already have acces to it via Image class
8 years ago
Michał Walenciak 65722a0020 dropping bSwap parameter
Member is better.
8 years ago
Michał Walenciak 7e291ef226 Encapsulating Header's members 8 years ago
Michał Walenciak cb3857c675 removing useles code 8 years ago
Michał Walenciak ff21b5a962 restore position if necessary 8 years ago
Michał Walenciak cc8c470620 fix header read + tag name dump 8 years ago
Michał Walenciak 5ab1a0809d adopt to style 8 years ago
Michał Walenciak 5fa328737a moving implementation from stand alone parser 8 years ago
Michał Walenciak c008ad2403 making tag related functions private 8 years ago
Michał Walenciak 307faae830 introducing tiff Header + header builder function 8 years ago
Michał Walenciak ab27bfab3c introducing getULongLong() 8 years ago
Michał Walenciak dc331ee44a implementing isBigTiffType 8 years ago
Michał Walenciak b3aa2adf31 initial implementation of newBigTiffInstance() 8 years ago