Commit Graph

5640 Commits

Author SHA1 Message Date
D4N
24ef91fcf9
Merge pull request #380 from D4N/misc_issues_fix
Fix various memory issues and enable ASAN for the test suite
2018-07-29 21:11:32 +02:00
Dan Čermák
664e93c057 [travis] Enable ASAN for the test suite 2018-07-29 00:20:43 +02:00
Dan Čermák
b12a868454 Add EXV_WARN_UNUSED_RESULT macro & add it to DataBuf::release()
EXV_WARN_UNUSED_RESULT is a conditional macro that expands to either
__attribute__((warn_unused_result)) on gcc & clang or to _Check_return
for MSVC
=> Compiler warns if the return value is ignored
2018-07-29 00:20:43 +02:00
Dan Čermák
1ab921cb83 Add two padding bytes to exifLongHeader to prevent overreads
in the following call:
getHeaderOffset (payload.pData_, payload.size_, (byte*)&exifLongHeader, 6);

getHeaderOffset would read 6 bytes from exifLongHeader, reading beyond the
bounds of the array => add 2 padding bytes to prevent overreads
2018-07-29 00:20:43 +02:00
Dan Čermák
dbf90b976f Fix overread in memcmp in PngImage::doWriteMetadata()
memcmp() compares the read data from key with the provided string, but when
key.pData_ is shorter than the provided length, then memcmp can read beyond the
bounds of key.pData_
=> add custom compare function, which ensures that we never read more than
key.size_
2018-07-29 00:20:43 +02:00
Dan Čermák
8d5a3c7dd9 Remove buffer overread in tExtToDataBuf
The pointer p is advanced in the while loop to step over three '\n'.
However, its length is never reduced accordingly. => the length check in the
following for loop is invalid, as it permits overreading by the number of
characters that p was advanced by.
2018-07-29 00:20:30 +02:00
Dan Čermák
67dc3e691f [IptcData::printStructure] clang-format function 2018-07-29 00:00:52 +02:00
Dan Čermák
b2c3b61abc [IptcData::printStructure] Remove buffer overrun
The loop condition will perform a range check correctly, but it will always
dereference bytes[i], even if i is too large and fails the second check.
=> move the bytes[i] == 0x1c check into a if, after the range check was
successfull
2018-07-28 23:50:33 +02:00
Dan Čermák
39399ac5e8 Remove memory leak in SshIo::SshImpl::getDataByRange
The buffer array is not deleted, when an exception is thrown
(happens for nBytes< 0).
=> use std::vector<char> instead
2018-07-28 23:50:33 +02:00
Dan Čermák
607b19111c [DataBuf] Replace wrong usage of release() with free() 2018-07-28 23:50:33 +02:00
Dan Čermák
1b74db8f51 [types] Add DataBuf::free()
DataBuf::release() easily cause memory leaks, when the return value is
ignored. free() provides the desired behavior, when the internal data should
just be deleted and not used further.
2018-07-28 23:50:33 +02:00
D4N
505e2417e4
Merge pull request #379 from D4N/fix_378
Fix for #378
2018-07-17 00:10:20 +02:00
Dan Čermák
81b6d36c90 [webp] Enforce minimum read size in decodeChunks
The size parameter is only checked for upper bounds, but not for lower.
If it is too small, then created dataBuf will be too small and overflow in one
of the subsequent memcpy() calls.

This fixes #378 / CVE-2018-14046
2018-07-16 23:40:56 +02:00
Dan Čermák
f522cbf460 [testsuite] Add reproducer for #378/CVE-2018-14046 to the testsuite 2018-07-16 23:40:23 +02:00
Luis Díaz Más
6a203c70c0 Include missing unused.h header in convert.cpp 2018-07-09 22:17:47 +02:00
Luis Díaz Más
bb9ce23e76 Set EXV_HAVE_XMP_TOOLKIT correctly. set() does not accept logical operators 2018-07-09 22:17:47 +02:00
AndreasMartin72
33c0416bc8 Bugfix for build error (Win7, msvc)
Ref: https://github.com/Exiv2/exiv2/issues/371#issuecomment-401319696
2018-07-05 18:28:26 +02:00
D4N
341de4500a
Merge pull request #368 from D4N/fix_issue_365
Fix #365 and #366
2018-06-11 23:29:54 +02:00
Dan Čermák
b761c6d056 Remove useless casts in preview.cpp 2018-06-11 22:55:49 +02:00
Dan Čermák
b517f2e13b Add regression test for #366 to the testsuite 2018-06-11 22:55:49 +02:00
Dan Čermák
fe70939f54 Fix addition overflows in range checks in LoaderTiff::getData
Several checks for extracted values performed no overflow checks on the
addition. They can be tricked into passing, albeit the individual summands are
too large.
=> use Safe::add() which now aborts when an overflow occurs
This fixes #366
2018-06-11 22:55:49 +02:00
Dan Čermák
9b08354aca Add reproducer for #365 to the testsuite 2018-06-11 22:55:49 +02:00
Dan Čermák
f4e8ed2fd4 Catch all exceptions not caught in exiv2 cli-tool
It effectively looks the same as before, only now we don't call abort() but
instead clean up everything gracefully.
2018-06-11 22:55:49 +02:00
Dan Čermák
937a1a2bd0 Add offset_ and size_ safely in LoaderExifJpeg::LoaderExifJpeg
offset_ can become arbitrarily large and overflows once its added to size_,
this causes all kinds of problems further in the code when offset_ is used
again.
=> Use Safe::add() to catch potential overflows
This fixes #365.
2018-06-11 22:55:41 +02:00
Dan Čermák
8393064416 Fix accidentally removed tests target 2018-06-10 17:27:37 +02:00
Luis Diaz Mas
0d6abb5b51 Remove leftovers from autotools and .gitignore 2018-06-08 14:04:25 +02:00
Luis Diaz Mas
a3444f055e Rename config folder to cmake 2018-06-08 14:04:25 +02:00
Luis Diaz Mas
69ee165291 msvc: Remove manually generated configuration files for MSVC builds 2018-06-08 14:04:25 +02:00
Luis Diaz Mas
41bb15f7b7 Remove usage of CMAKE_DEBUG_POSTFIX
This option should be provided when calling to the cmake command.
Otherwise, we overwrite the value even when the user pass the value
in the command line.
2018-06-08 14:04:25 +02:00
Luis Diaz Mas
c49882159a Remove msvc folder 2018-06-08 14:04:25 +02:00
Luis Diaz Mas
abf6e8ec27 Remove code related with autotools 2018-06-08 14:04:25 +02:00
D4N
f1c4734e84
Merge pull request #357 from Exiv2/gitlab_deploy_test
Add Gitlab deploy stage
2018-06-08 09:12:13 +02:00
Dan Čermák
de2e260d0c Fix doxygen documentation generation
The tagfile location in the Doxyfile was wrong and would point to a non-existent
location, causing make doc to fail.
2018-06-07 23:46:33 +02:00
Dan Čermák
b8a9423c5a [CI] Deploy documentation to GitLab pages 2018-06-07 23:46:31 +02:00
Dan Čermák
7ac40ba0b2 [CI] Move CCache config out of python build script 2018-06-07 23:45:52 +02:00
Dan Čermák
7d1d10c338 [CI] Add installation test to GitLab CI 2018-06-07 23:45:39 +02:00
Dan Čermák
653814afb0 [testsuite] Allow setting the binary location for make tests 2018-06-07 10:19:59 +02:00
Luis Diaz Mas
71638014a3 CMake: control doc generation with a new CMake option 2018-06-07 01:55:05 +02:00
Luis Diaz Mas
211a7a3edd Require dot command for 'doc' and change output folder
dot is needed to generate the exiv2 documentation. Furthermore we were
generating the documentation in ${PROJECT_BINARY_DIR}/html while the
CMake 'install' command was expecting to find the documentation directory
at ${PROJECT_BINARY_DIR}/doc/html. This has been also fixed in this
commit.
2018-06-07 01:55:05 +02:00
D4N
493b7284ae
Merge pull request #353 from Exiv2/redmine_issues_831_to_937
Port redmine issues 831 to 937 to the new testsuite
2018-06-06 15:28:44 +02:00
Dan Čermák
35e7037f86 [testsuite] Change the calling order of setUp & tearDown in decorator
The FileDecoratorBase injects a new setUp & tearDown function. These new
functions would call the old setUp & tearDown in an inconvenient order: e.g. the
child class CopyFiles would at first call the user provided setUp and then copy
the files. This makes it impossible to perform some action on the file copy in
setUp.
=> This commit changes the call order, so that setUp & tearDown always "see" the
finished environment after file copies are in place and before any cleanup took
place.
2018-06-06 13:59:45 +02:00
Dan Čermák
39b7151b2e [testsuite] Port redmine issues 831 to 937 to the new testsuite 2018-06-06 13:59:34 +02:00
Dan Čermák
7e1cd7d1b6 [testsuite] Fix name of regression test #283
issue got a CVE assigned
2018-06-06 13:31:53 +02:00
Luis Díaz Más
d9d2c2217a CMake: macro to generate documentation
We use now the Doxyfile.in template file with some variables that are
replaced at configuration time by absolute paths. Therefore, we can run
later the doxygen command with absolute paths from the
PROJECT_BINARY_DIR.

The CMake 'doc' target is added only if doxygen is available in the
system.
2018-06-04 14:05:40 +02:00
D4N
4f9d3e4836
Merge pull request #153 from tbeu/more-cleanup
More cleanup
2018-06-02 09:54:32 +02:00
tbeu
6b1615840f Remove redundant check
V547 Expression 'bPrint' is always true. rafimage.cpp 112
V547 Expression 'bPrint' is always true. rafimage.cpp 125
V547 Expression 'bPrint' is always true. rafimage.cpp 136
V547 Expression 'bPrint' is always true. rafimage.cpp 147
V547 Expression 'bPrint' is always true. rafimage.cpp 158
V547 Expression 'bPrint' is always true. rafimage.cpp 169
V547 Expression 'bPrint' is always true. rafimage.cpp 190
V547 Expression 'bPrint' is always true. rafimage.cpp 213
V547 Expression 'bPrint' is always true. rafimage.cpp 236
V547 Expression 'bPrint' is always true. rafimage.cpp 252
V547 Expression 'bPrint' is always true. rafimage.cpp 262
V547 Expression 'bPrint' is always true. rafimage.cpp 272
2018-06-02 09:43:20 +02:00
tbeu
eca251865f Fix check (on comparing unsigned minus signed greater zero)
V555 The expression 'object->sizeDataArea_ - buf.size_ > 0' will work as 'object->sizeDataArea_ != buf.size_'. tiffvisitor.cpp 911
2018-06-02 09:43:20 +02:00
tbeu
bb9034e029 Do not implicitly cast enum to Boolean
V768 The expression 'fileProtocol(path)' is of enum type. It is odd that it is used as an expression of a Boolean-type. futils.cpp 288
2018-06-02 09:43:20 +02:00
tbeu
12d0da619b Use clear to reset string
V815 Decreased performance. Consider replacing the expression 'token = ""' with 'token.clear()'. http.cpp 193
2018-06-02 09:43:20 +02:00
tbeu
9569ef2fda Use auxiliary variable
V807 Decreased performance. Consider creating a reference to avoid using the 'image_.exifData()' expression repeatedly. preview.cpp 530
2018-06-02 09:43:20 +02:00