Commit Graph

71 Commits

Author SHA1 Message Date
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
5bc444ff00
Use DataBuf rather than raw malloc. 2021-08-04 20:55:20 +01:00
Kevin Backhouse
2b84f4bd64
fix: zero initialize local variables. (#1743)
* Zero initialize local variables.

* Initialize xmpID_
2021-06-27 08:56:31 +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
86c71ae6c3 clang-tidy: avoid global non const variables
Found with cppcoreguidelines-avoid-non-const-global-variables

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-05-25 08:43:27 +02:00
Rosen Penev
c44c289d76 clang-tidy: fix ending namespace comnments
Found with llvm-namespace-comment

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-05-19 23:08:08 -07:00
Rosen Penev
743da1a564 clang-tidy: use C++ casting
Found with google-readability-casting

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-05-20 07:29:02 +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
Kevin Backhouse
ca66136092 Use readOrThrow to check error conditions of iIo.read().
(cherry picked from commit 0f9eb74c44c908e170a64cab590949d53749af8e)
2021-05-13 11:51:15 +02:00
Rosen Penev
8337462032 clang-tidy: use empty() instead of comparing size
Found with readability-container-size-empty

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-05-11 22:02:47 +02:00
Kevin Backhouse
783b3a6ff1 Improve bound checking in WebPImage::doWriteMetadata() 2021-04-20 21:43:56 +02:00
Luis Díaz Más
de4d43d4d1 Fix warnings EXIV2_TEAM_EXTRA_WARNINGS
Most of the warnings fixed were:
- Hiding of local variables
- Hiding of globals
- Useless casts
- Conversions between float/double
2021-04-18 18:49:58 +02:00
Luis Díaz Más
0bbaa6eff3 cpp: Replace auto_ptr by unique_ptr 2021-04-15 06:56:11 +02:00
Robin Mills
d632988bbd Massive code prolog cleanup. 2021-03-17 13:34:21 +00:00
clanmills
2bad338b9d Fix compiler warning on macOS about enforce condition being always true. 2020-05-14 10:03:10 +01:00
Luis Díaz Más
e925bc5add Fix integer overflow by checking size against header_size
Note that the problem occurs when data_size is less than header_size
what causes a buffer overflow in &data[i]

Co-Authored-By: D4N <dan.cermak@cgc-instruments.com>
2019-07-15 22:35:51 +02: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
6a44698abc Small change to comment. 2019-05-12 14:15:21 +02:00
Kevin Backhouse
3c818f49d9 Revert accidental whitespace change. 2019-05-12 14:15:21 +02:00
Kevin Backhouse
3faeaefbf5 Improve portability of bounds checks. 2019-05-12 14:15:21 +02:00
Kevin Backhouse
86816c0280 Fix signed/unsigned mismatch. 2019-05-12 14:15:21 +02:00
Kevin Backhouse
caa4e6745a Avoid negative integer overflow when filesize < io_->tell().
This fixes #791.
2019-05-12 14:15:21 +02:00
Robin Mills
a33041a8b7 Fix: https://github.com/Exiv2/exiv2/issues/562 for stringFormat() crashes. 2018-12-09 18:54:40 +01:00
Robin Mills
03b4f1deae Fix: https://github.com/Exiv2/exiv2/issues/580 2018-12-09 18:54:40 +01:00
skal
ecaf1dd478 Fix alpha bit detection in VP8L chunks
As per the spec ([1]), the alpha_bit is located on the 4th byte of the payload, just after the height.

This seems to fix the bug reported on GIMP ([2]) where an incorrect file was generated.



[1] https://developers.google.com/speed/webp/docs/webp_lossless_bitstream_specification#2_riff_header
[2] https://gitlab.gnome.org/GNOME/gimp/issues/1818
2018-11-26 16:43:55 +01:00
Dan Čermák
fec6535ae8 [binaryToString] Reimplement using Slices
- reimplement binaryToString:
  - it now accepts a Slice and nothing else
  - it does not return a std::string but instead a proxy object that implements
    operator<< (this should be more efficient, as we do not need to touch the
    heap in most cases)
- addapt unit tests
- replace all occurences with the new API
2018-10-11 14:06:16 +02:00
Luis Díaz Más
b118192f94 Fix cppcheck issues: redundantAssignment 2018-10-11 13:40:03 +02:00
Luis Díaz Más
603692a1d8 Copyright to Exiv2 authors 2018-09-12 19:22:31 +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
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
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
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
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
2018-03-27 23:46:13 +02:00
Dan Čermák
efe2ccdcb6 Replaced all hardcoded error codes with ker... constants 2018-02-18 09:28:57 +01:00
tbeu
5b5987a596 Remove obsolete EXIV2_RCSID 2017-11-19 11:17:12 +01:00
tbeu
5df8b01b77 Remove obsolete svn revision 2017-11-19 11:17:11 +01:00
clanmills
d43cd82002 Fix #80 2017-09-29 10:01:22 +01:00
Luis Díaz Más
1c03767391 Move inclusion of private header from .hpp to .cpp (not needed in the .hpp) 2017-08-18 13:55:45 +02:00
Robin Mills
11993b3b55 #1271 Thanks to Ben for reporting this and providing the patch. 2017-03-15 21:30:55 +00:00
Robin Mills
6d5c2c3256 Getting ready to release v0.26 2017-03-08 20:42:28 +00:00
Robin Mills
2ebacb6b0b #1272 Use in-memory temporary files. 2017-03-05 17:42:12 +00:00
Robin Mills
f5956d5db2 #1230 Fixes to read tiff with web-ready. Includes the BasicIo expiremental API readUnmarked() and markRead() which I will remove later. 2016-10-17 15:48:42 +00:00
Robin Mills
a1877c04e2 #1230 and #1199 Correction to r4575 2016-09-27 19:26:18 +00:00
Robin Mills
681acc7901 #1199 and #1230 webpImage::printStructure(). Reporting Offset == 0 on Tiger (32bit). 2016-09-27 19:21:45 +00:00
Robin Mills
8ad06d6f17 #1199 Fixing build-breaker when -DDEBUG is used. 2016-08-27 17:36:29 +00:00
Robin Mills
fa24a8a614 #1199 Fixing webp-test.sh. Use -iXX to inject XMP into file without XMP->Exif/IPTC conversion 2016-08-22 20:54:24 +00:00
Robin Mills
027b3917ec #1199 Spit'n'polish on the loops in printStructure(), metadataRead() and doWriteMetadata(). Added tests with even byte count for ICCP and XMP Chunks. 2016-08-20 14:11:54 +00:00
draekko
ed7b20a20e #1199 fixed typo from cut/paste in previous commit causing exif flag not to be set for VP8X chunk. 2016-08-20 13:11:22 +00:00