Commit Graph

2761 Commits

Author SHA1 Message Date
Luis Diaz Mas
9586928d29 Add CMake code to handle external XMP
Experiment: Try with testing package
2018-05-29 10:03:41 +02:00
Dan Čermák
a1a9c3d79a Use reinterpret_cast instead of C style cast 2018-05-27 12:11:30 +02:00
Dan Čermák
b51b6fc52d Prevent an out of bounds read in strstr in JpegBase::printStructure
The xmp byte array is not necessarily null terminated => strstr can read beyond
the bounds of the allocated array then.
Therefore use string_from_unterminated to remedy this issue.
Also replace xmp with a std::vector, as stl functions can throw and we don't
want a memory leak.
2018-05-27 12:11:30 +02:00
Dan Čermák
510560bbd1 Prevent out of bounds read in jpgimage.cpp JpegBase::printStructure
signature is extracted from an image and can lack the terminating \0, this
causes the std::string constructor and strcmp to read beyond the bounds of the
allocated array.
=> Use string_from_unterminated to construct a std::string safely and use it
in the subsequent code & use stl functions instead of C functions
2018-05-27 12:11:10 +02:00
Dan Čermák
dd52b1a832 Add helper_functions.cpp/hpp & unit tests
- add function which constructs a new std::string from a potentially not null
  terminated char *
- add unit tests
2018-05-27 09:38:27 +02:00
Luis Diaz Mas
59493d1edc Fix bug in Cr2Header::read 2018-05-26 18:19:40 +02:00
Luis Diaz Mas
1d27c21639 Rename files from cr2image_int to cr2header_int 2018-05-26 18:19:40 +02:00
Luis Diaz Mas
67a5a74115 Throw when trying to write out of the buffer 2018-05-26 09:59:37 +02:00
Luis Diaz Mas
863aaebc92 Use index to access buf.pData_ 2018-05-26 09:59:37 +02:00
Luis Diaz Mas
ed874703ad Prevent call to memcpy with size==0 2018-05-26 09:59:37 +02:00
Luis Diaz Mas
f17636460f Remove tags_int.cpp that was not used in the project
I introduced that file accidentally in the project while trying to move
the implementation details to xxx_int.cpp files. In this case, I found
out some issues and I just decided to leave the implementation in the
file tags.cpp.
2018-05-24 19:58:41 +02:00
Luis Diaz Mas
1371d677f9 Remove custom messages from enforce(xxx, Exiv2::kerCorruptedMetadata) 2018-05-23 14:14:39 +02:00
Luis Diaz Mas
c0a879aea4 Fix call to std::count, so that we count until the end of the array 2018-05-23 14:14:39 +02:00
Luis Diaz Mas
3ad0050469 Check validity of compressionFlag & compressionMethod 2018-05-23 10:57:13 +02:00
Luis Diaz Mas
2fb00c8a16 Analyze minimum needed number of null separators in PngChunk::parseTXTChunk
This commit fixes the heap-buffer-overflow in PngChunk::parseTXTChunk.

According to the specification:
http://www.libpng.org/pub/png/spec/1.2/PNG-Chunks.html

There must be 2 null separators when we start to analyze the language tag.
2018-05-23 10:57:13 +02:00
Luis Diaz Mas
a227fcda39 debug: Add new debug message to print the PNG chunk being processed 2018-05-23 10:57:13 +02:00
Luis Diaz Mas
b0696d4da6 style: Apply formatting guidelines to one-line ifs 2018-05-23 10:57:13 +02:00
Luis Diaz Mas
4922df6018 Replace '\n' by endl that flush content. Useful for debugging 2018-05-23 10:57:13 +02:00
Luis Díaz Más
c3629117d8 conan: Upgrade libcurl version
Thanks to this upgrade the cmake code that handles the CURL dependency
can be simplified. Now we can use the shared version of CURL in all the
platforms. However we will use for the moment the static version on Mac,
since we are having some issues with 'make tests'. Once those tests are
migrated to python we can also use the shared version there.
2018-05-22 22:53:18 +02:00
Daniel Zucchetto
4e55af8691
Support Canon M100 2018-05-19 20:44:31 +01:00
Dan Čermák
4b24e011dc Free potentially allocated regexes from Params::evalGrep
In Params::evalGrep regcomp allocates some internal space for the regex objects,
which must be freed manually via regfree(). This was however only done when the
call to regcomp() failed and not on success. As the regexes are needed later,
they have to be deallocated by the destructor.
2018-05-17 17:17:37 +02:00
Dan Čermák
bf51a76e4e [safe_op] Fix ODR violation in compiler builtin specializations
The compiler instrinsics are exposed via fully specialized template functions
which must not be defined twice (which they accidentally were). Declaring them
as inline fixes this issue.
2018-05-16 12:48:48 +02:00
Dan Čermák
1d7dd0892c Fix errors not being passed by reference to error() function
- error was passed by value, but a new error message should be appended to it
  => error must be called by reference
- use default parameters of error() in http()
- rename variables to fix shadowing
2018-05-16 10:15:53 +02:00
Dan Čermák
571f97e277 Use __attribute__((format)) in clang too 2018-05-16 10:15:53 +02:00
Dan Čermák
222c65be63 Refactor Nikon case in bigtiffimage
- remove name shadowing
- user std::vector<> instead of raw array
2018-05-16 10:15:53 +02:00
Dan Čermák
4c4d568036 Enforce a valid Value (instead of assert) 2018-05-16 10:15:53 +02:00
Dan Čermák
e2b06856d8 Change type of size to uint64_t to avoid a useless cast
The variable size is only populated via getUint64_t => uint64_t is better suited
then unsigned long
2018-05-16 10:15:53 +02:00
Dan Čermák
316548d2de Fix shadowing issues
- renamed variables that were shadowing a previously defined variables
2018-05-16 10:15:53 +02:00
Dan Čermák
5e36363138 Fix double promotion issues 2018-05-16 10:15:53 +02:00
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)
2018-05-16 10:15:53 +02:00
Dan Čermák
bb2019149a [safe_op] Don't use overflow intrinsics in MSVC 2005 2018-05-08 21:52:52 +02:00
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
2018-05-07 10:25:26 +02:00
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
2018-05-06 11:58:22 +01:00
Luis Díaz Más
f86542e5f6 Remove EXV_HAVE_STRTOL 2018-05-04 11:20:43 +02:00
Luis Díaz Más
d55b2b1b65 Remove HAVE_STDLIB_H check and replace stdlib.h by cstdlib 2018-05-04 11:20:43 +02:00
Luis Díaz Más
aded1965c5 Remove EXV_HAVE_MEMSET 2018-05-04 11:20:43 +02:00
Luis Díaz Más
abd28a6a9e Remove EXV_HAVE_STRCHR 2018-05-04 11:20:43 +02:00
Dan Čermák
fc60d97a29 Prevent passing of null-pointers to libc functions 2018-04-25 00:13:41 +02:00
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.
2018-04-25 00:13:26 +02:00
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.
2018-04-19 17:19:47 +02:00
Luis Díaz Más
fbd8e2669e sort alphabetically the sources in src/CMakelists.txt 2018-04-09 23:04:35 +02:00
Luis Díaz Más
de5b9ebf89 Remove duplication of sources in src/CMakeLists.txt 2018-04-09 23:04:35 +02:00
Luis Díaz Más
ffbcaa2e6d Fix MSVC warning C4267: conversion from 'size_t' to 'long' 2018-04-09 15:54:27 +02:00
Luis Díaz Más
bd40c18f1c Use variable in TimeValue::copy to remove -Wunused-variable warning 2018-04-08 10:10:12 +02:00
Luis Diaz Mas
a246c73d6f Use unused variable instead of hard-coded values in DateValue::copy 2018-04-08 10:10:12 +02:00
Luis Díaz Más
bf7047a71b clang-format XmpKey code 2018-04-07 20:04:22 +02:00
Luis Diaz Mas
07d75cd0e8 Check if ExifData::findKey return valid iterators 2018-04-02 17:46:29 +02:00
Luis Díaz Más
858c99b4df Add enforce before calling REPORT_MARKER with invalid marker 2018-04-01 08:20:22 +02:00
Luis Díaz Más
5e5d76ad0a clang format function 2018-03-30 08:10:58 +02:00
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.
2018-03-27 23:46:13 +02:00