Commit Graph

7692 Commits

Author SHA1 Message Date
Dan Čermák
7d7bbec517 [Travis CI] Add gcc 8 to the build for UBSAN 2018-08-27 17:22:33 +02:00
Dan Čermák
da7239cf74 [Travis CI] Enable sanitizers for gcc & OSX builds 2018-08-27 17:22:33 +02:00
Dan Čermák
10929cec7a [CMake] Add EXIV2_TEAM_USE_SANITIZERS option
Setting this option enables address sanitizer and undefined behavior
sanitizer, when available for the given compiler & platform.
It does not currently check whether the architecture is supported,
as CMake does not offer an easy way how to check it. Since we are
mostly developing for x86 & amd64 this is not a huge problem and it's
also a developer only setting.
2018-08-27 17:22:33 +02:00
Dan Čermák
9f1a5a1ebb [futils] Change signature of getEnv to take an int
While taking an EnVar as the parameter is more clear it has the
disadvantage, that passing anything outside of the range of the
enumeration is undefined behavior. The compiler could then optimize
the range check in getEnv away (perfectly legal due to UB), leading
to buffer overreads.
2018-08-27 17:22:33 +02:00
Dan Čermák
e705f1ef5b Add unit test for floatToRationalCast 2018-08-27 17:21:16 +02:00
Dan Čermák
11df43be78 [types] Apply Safe::abs() in floatToRationalCast & gcd
Also check for infinity in floatToRationalCast as depending on the
compiler special values of floats are converted to either
LONGMAX/LONGMIN or +/-inf
2018-08-27 17:21:16 +02:00
Dan Čermák
2dacb19933 [safe_op] Add Safe::abs(), calculates absoulte value without UB
Add a drop-in replacement for std::abs which never produces
negative values and thereby never invokes undefined behavior.
2018-08-27 17:21:16 +02:00
Luis Diaz Mas
8b47a8efc1 Include timegh.h in file which needs it 2018-08-27 13:33:02 +02:00
Luis Diaz Mas
a9c9451588 Remove localtime.c and any other trick to handle timegm 2018-08-27 13:33:02 +02:00
Luis Diaz Mas
eb306fdbae Substitute malloc/free with new/delete 2018-08-27 13:24:47 +02:00
Luis Diaz Mas
08cbb0c206 Use header guards instead of pragma once 2018-08-27 13:24:47 +02:00
Luis Diaz Mas
669ab49c43 New tests for Uri class 2018-08-27 13:24:47 +02:00
Luis Diaz Mas
ca290d870f New tests for base64 encode & decode 2018-08-27 13:24:47 +02:00
Luis Diaz Mas
5d76036af5 Add more tests for decoding and encoding URL functions 2018-08-27 13:24:47 +02:00
Luis Diaz Mas
eefee8125b to_hex and from_hex removed from API 2018-08-27 13:24:47 +02:00
Luis Diaz Mas
22d9ab82a7 Format futils.h for better readability (also pass clang-format to it) 2018-08-27 13:24:47 +02:00
Luis Diaz Mas
c82d875707 Use pragma once instead of guards 2018-08-27 13:24:47 +02:00
Luis Diaz Mas
a3c200a23e Remove useless header inclusions 2018-08-27 13:24:47 +02:00
Luis Diaz Mas
41499b8ecd Use snprintf instead of sprintf in TimeValue::copy
- Replaced assert by enforce
2018-08-27 13:02:56 +02:00
Luis Díaz Más
1128d8926a Appveyor: Run CI with VS 2015 and 2017.
In order to achieve this objective the following actions were taken:
- Do not use the Ninja Generator, since it is more difficult to choose
  VS toolset to be used.
- Use arch x64 for conan and the CMake Generators (by default)
- Do not create profiles dir manually
- Detect new default conan profile automatically
- Remove clcache from appveyor since it does not integrate well with VS generators
- VS2013 removed from the matrix since some integration tests fail there.
2018-08-26 19:00:45 +02:00
Luis Diaz Mas
0bc6fbcea7 Add stdexcept header in unit test files 2018-08-26 15:46:47 +02:00
Luis Diaz Mas
d96b619515 Add braces for the main functions in the new source files at samples 2018-08-26 09:23:08 +02:00
Luis Diaz Mas
7d8edbe781 Remove more dead code 2018-08-26 09:23:08 +02:00
Luis Diaz Mas
00502eabdd Move mrwthumb to samples 2018-08-26 09:23:08 +02:00
Luis Diaz Mas
e9a6597a48 Move xmpdump to samples 2018-08-26 09:23:08 +02:00
Luis Diaz Mas
ac51fda7b5 Move crwparse to samples 2018-08-26 09:23:08 +02:00
Luis Diaz Mas
32b618b1c7 Move crwedit from exiv2lib to samples 2018-08-26 09:23:08 +02:00
Luis Diaz Mas
f9b2784055 Remove utiltest.cpp that is not compiled 2018-08-26 09:23:08 +02:00
Luis Diaz Mas
ad004498a2 Cleanup 'comparison between signed & unsigned integer' warning 2018-08-24 16:45:52 +02:00
Luis Diaz Mas
00f86a8df4 Cleanup unused variable warnings 2018-08-24 16:45:52 +02:00
Luis Diaz Mas
6e244f31d3 Cleanup fallthrough warning + clang-format parseCommonTargets function 2018-08-24 16:45:52 +02:00
Luis Diaz Mas
0d9065274e Remove redefinition of UNUSED 2018-08-24 16:45:52 +02:00
D4N
a93cb04361
Merge pull request #407 from D4N/fix_400
Fix issue #400 (overreads in PngChunk::parseTXTChunk())
2018-08-21 14:09:13 +02:00
Dan Čermák
dadd1d19f9 Add reproducer for #400 to the test suite 2018-08-21 13:46:53 +02:00
Dan Čermák
35b3e596ed Add overflow & overread checks to PngChunk::parseTXTChunk()
This function was creating a lot of new pointers and strings without
properly checking the array bounds. This commit adds several calls
to enforce(), making sure that the pointers stay within bounds.
Strings are now created using the helper function
string_from_unterminated() to prevent overreads in the constructor of
std::string.

This fixes #400
2018-08-21 13:46:53 +02:00
Dan Čermák
6da77e2c64 Add documentation for parameters of string_from_unterminated 2018-08-21 13:44:35 +02:00
Dan Čermák
b127354429 Simplify string_from_unterminated by using strnlen() 2018-08-21 13:44:35 +02:00
Luis Diaz Mas
2540981aae travis-osx: do not install libssh openssl (already installed) 2018-08-21 13:32:37 +02:00
Luis Diaz Mas
eedc4aef5f Add doc indicating how to consume exiv2 with CMake 2018-08-20 13:50:23 +02:00
Luis Diaz Mas
17ad919ec2 CMake: Add RPATH configuration for Linux/Solaris
Note that this RPATH setup is following a recommendation from the CMake
documentation:
https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/RPATH-handling#recommendations
2018-08-17 10:28:08 +02:00
Luis Diaz Mas
cefe0e5b0a conan: Use the same conan version in all the platforms (1.6.1) 2018-08-15 15:01:15 +02:00
clanmills
ce516eddef Issue-374 2018-08-08 22:28:54 +02:00
Robin Mills
20d21ec3dc #350 2018-08-08 20:34:26 +02:00
Luis Diaz Mas
8ba9422ba3 travis: Enable coverage reports in gcc build
* I also had to update the conan version to fix some issues in CI.
* Codecov reports are now added to the README.md and to each PR.
2018-07-31 23:43:46 +02:00
Luis Diaz Mas
6521f7c4f9 cmake: new option to enable compilations with coverage flags
Note that this will only work with gcc and clang.
2018-07-31 23:43:46 +02:00
Luis Diaz Mas
3d35b93fc0 Skip test 1054 unless timezone is UTC 2018-07-31 18:18:14 +02:00
Luis Diaz Mas
59585fa3af [Travis] export TZ=UTC before running tests
This is needed in some tests which are using exiv2json.
It seems that during metadata conversion, the dates are converted from the
original timezone (which seems to be saved in xmp) into the local time zone.
2018-07-31 18:18:14 +02:00
Luis Diaz Mas
145f8fc456 Port redmine issues from the bash test suite to the python one.
* Port redmine issue 1024
 * Port redmine issue 1026
 * Port redmine issue 1040
 * Port redmine issue 1044
 * Port redmine issue 1053
 * Port redmine issue 1054 (not finished yet; I found some issues there)
 * Port redmine issue 1058
 * Port redmine issue 1062
 * Port redmine issue 1080
 * Port redmine issue 1108
 * Port redmine issue 1112
 * Port redmine issue 1114
 * Port redmine issue 1122
 * Port redmine issue 1140
 * Port redmine issue 1144
 * Port redmine issue 1145
 * Port redmine issue 1153
 * Port redmine issue 1155
 * Port redmine issue 1166
 * Port redmine issue 1167
 * Port redmine issue 1170
 * Replace escaped chars in 1054
 * Add brackets in exiv2json::main()
 * Link all sample apps against exiv2lib
 * Changes in 1054
 * test 1054: fix dates depending on Local time
 * Do not run make with VERBOSE=1
 * Use system_tests.path
 * Fix windows issues with quotes
 * Use system_tests.path
 * Use itertools to simplify test code
2018-07-31 18:18:14 +02:00
Robin Mills
4e47c20f97
Merge pull request #389 from piponazo/clcache
Enable clcache usage and use it in appveyor
2018-07-30 21:18:27 +01:00
Luis Díaz Más
5eee072089 Enable clcache usage and use it in appveyor
* [appveyor] Install clcache with nuget
* [appveyor] Keep clcache in the appveyor jobs
* [appveyor] Print clcache stats after compiling the project
* Use CLCACHE_PATH env variable to find clcache
2018-07-30 21:31:23 +02:00