Commit Graph

41 Commits

Author SHA1 Message Date
Kevin Backhouse
81cfc162c1
Use std::move to transfer ownership of DataBufs. 2021-10-10 23:56:00 +01:00
Kevin Backhouse
5fdd9da3d3
Use =default. 2021-10-09 21:39:15 +01:00
Kevin Backhouse
482cb2ded5
Clarify ownership model of CiffComponent::pData_ 2021-09-26 15:52:58 +01:00
Kevin Backhouse
e71b99b236
Merge pull request #1886 from kevinbackhouse/private-pData
Make fields of DataBuf private
2021-09-09 22:21:02 +01:00
Kevin Backhouse
bd211a90ac
Credit to OSS-Fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=37889
Avoid reading 1 byte off the end when the string does not contain a '\0' byte.
2021-09-02 10:26:08 +01:00
Kevin Backhouse
9ff72e5ca5
Make offset=0 the default parameter. 2021-08-30 12:41:08 +01:00
Kevin Backhouse
c9d0cf3643
Make fields of DataBuf private. 2021-08-29 15:43:10 +01:00
Kevin Backhouse
ad5e6c479c
Extra checking to prevent the loop counter from wrapping around. 2021-07-18 14:53:07 +01:00
Kevin Backhouse
fa52d7e2cb Better way to print the error message. 2021-07-15 19:25:37 +02:00
Kevin Backhouse
6685b8db4a Print message to stderr when EXIV2_DEBUG_MESSAGES is enabled. 2021-07-15 19:25:37 +02:00
Kevin Backhouse
f724f4e2fc Don't crash if s > size. 2021-07-15 19:25:37 +02:00
Kevin Backhouse
c2b52119d4 Check that findKey didn't return end(). 2021-07-05 22:26:09 +02:00
mergify[bot]
1d64f482ff
fix: use vector::at() rather than operator[] (backport #1735) (#1741)
* fix: use vector::at() rather than operator[] (#1735)

* Regression test for https://github.com/Exiv2/exiv2/issues/1706

* Use vector::at() rather than operator[].

* Print to stderr when exception is caught and EXIV2_DEBUG_MESSAGES is enabled.

* Check that it prints "Bad value" for the date.

(cherry picked from commit f4d3adbf91e6dc4e34aee5bac7b7fd9e127a5c00)

# Conflicts:
#	src/value.cpp

* fix merge conflicts from mergify backport

Co-authored-by: Kevin Backhouse <kevinbackhouse@github.com>
Co-authored-by: Christoph Hasse <hassec@users.noreply.github.com>
2021-06-27 09:33:56 +02:00
Luis Díaz Más
f30022d73d
Fix issues detected with PVS-Studio + other little improvements (#1689)
* avoid re-declaration of constant variables

* Replace pthreads critical section with std::mutex

* ci - better naming

* cmake - increase minimum version to 3.11. Use project DESCRIPTION

* fix - do not treat string::find() return type as bool

* remove conditions that were always true

* remove condition that were always false

* Remove EXV_HAVE_GMTIME_R which is not used anymore

* pixelWidth_ was inherited from Exiv2::Image

The width & height variables in the TiffImage class need to be mutable
to be able to change their values on the getters pixelHeight() and
pixelWidth() ... Do not ask me why ...

* Remove superfluous if

* pvs:V766 item with identical key added already

* pvs:V730 not all members were initialized (time)

* pvs:V730 not all members are initialized

* pvs:v668 no point in testing pointer against null after new

* pvs:V1048 variable assigned the same value

* replace c-style dynamic vector with std one

* pvs:547 fakeData is always true

* Remove useless constructor in derived class

* pvs:V690 modern way to disable copy-ctor

* Replace malloc/free with new/delete. No need to check for null

* pvs:V1028 cast operands and not result

* Remove custom MIN/MAX functions

* pvs:V595 pointer used before verified against null

* pvs: index used before being checked

* pvs:V1028 possible overflow. Cast operands

* pvs:v575 potential null pointer passed to other functions

* pvs:V547 deal with always true/false expressions

* pvs:V560 part of conditional expressions always false or true

* pvs:V701 possible break in realloc -> move to std::vector

* Make some classes 'final'

* Replace sprintf with std::to_string()

* fix compilation on windows
2021-06-01 12:39:10 +02:00
Rosen Penev
2c57f214c5 clang-tidy: use nullptr
Found with modernize-use-nullptr

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-05-26 08:31:45 +02:00
Rosen Penev
6da49fd29b more constexpr
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-05-19 14:11:42 +02:00
Rosen Penev
b8712188bb clang-tidy: use auto
Found with modernize-use-auto

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-05-17 21:52:03 +02:00
Rosen Penev
20dfab8036 manual for range loop conversions
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-05-17 10:30:42 +02:00
Rosen Penev
1b9b77c51f clang-tidy: add ending namespace comments
Found with google-readability-namespace-comments

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-05-14 17:34:09 +02:00
Rosen Penev
2e73aa9dc0 default con/destructors in headers
Helps to optimize trivially destructable stuff.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-05-12 09:10:36 +02:00
Rosen Penev
8128716287 clang-tidy: use = default
Found with modernize-use-equals-default

Ran through git clang-format

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-05-09 15:18:50 +02:00
Luis Díaz Más
f85f7f717a Replace many of the iterators types with auto 2021-04-19 10:43:46 +02:00
Luis Díaz Más
0bbaa6eff3 cpp: Replace auto_ptr by unique_ptr 2021-04-15 06:56:11 +02:00
Kevin Backhouse
9b7a19f957
Fix integer overflow. 2021-04-09 13:37:48 +01:00
Kevin Backhouse
0a91b56616
Fix incorrect delete. 2021-04-09 13:27:21 +01:00
Robin Mills
d632988bbd Massive code prolog cleanup. 2021-03-17 13:34:21 +00:00
clanmills
6d7a5266ea fix_1219_mingw_crw_date_0.27 2020-05-26 07:36:45 +01:00
clanmills
698b418f73 fix_1097_0.27 2020-03-27 17:25:28 +01:00
derselbst
70b0c17421 Fix a memory leak in CiffHeader::read()
Memory for pPadding_ was allocated with new[] .
2019-11-03 07:25:45 +01:00
Jens Georg
b7890776c6 crwimage: Check offset and size against total size
Corrupted or specially crafted CRW images might exceed the overall
buffersize.

Fixes #1019

(cherry picked from commit 683451567284005cd24e1ccb0a76ca401000968b)
2019-10-07 22:14:15 +00:00
Luis Díaz Más
113136e134 Replace DEBUG with EXIV2_DEBUG_MESSAGES
Fixes #926
2019-07-12 11:14:35 +02:00
Kevin Backhouse
7798ae2557 Throw an exception if the data location is invalid. (#842) 2019-05-15 11:12:02 +02:00
Kevin Backhouse
c0ecc2ae36 Avoid integer overflow. 2019-05-13 22:46:25 +02:00
Luis Diaz Mas
6f8d8e3da6 cleanup header inclusions in API 2019-01-11 15:55:25 +01:00
Robin Mills
b3d077dcae Fix #460 by adding more checks in CiffDirectory::readDirectory 2018-10-14 11:58:25 +02:00
Luis Díaz Más
c4cc019dff Hide -Wunused-variable issues by using the UNUSED() macro 2018-09-12 19:22:31 +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
tbeu
e5a4f1cf35 Use auxiliary variable
V807 Decreased performance. Consider creating a reference to avoid using the 'image.exifData()' expression repeatedly. crwimage.cpp 1320
2018-06-02 09:43:20 +02:00
Dan Čermák
efe2ccdcb6 Replaced all hardcoded error codes with ker... constants 2018-02-18 09:28:57 +01:00
Luis Díaz Más
d3748152a7 add _int suffix to all the internal files 2017-11-28 17:36:08 +01:00