84 Commits (cca6f74200f461c4b0a6d66fa46e88e1097a07c3)

Author SHA1 Message Date
Luis Díaz Más b3a216310a Removing unused headers thanks to IWYU 3 years ago
Rosen Penev 04bacdedd6 clang-tidy: use auto
Signed-off-by: Rosen Penev <rosenp@gmail.com>
3 years ago
Luis Díaz Más b17828b454
Use SPDX for licenses (#2122)
* Use SPDX identifier in header files

* Use SPDX identifier in rest of source files

* Fix usage of SPDX for files with 2 licenses

* Add global license file

* Fix compilation
3 years ago
Luis Díaz Más b9f9d041ea Several transformations on DataBuf + migration to size_t
- Provide begin/end iterators to DataBuf and simplify code
- Adapt test output after last changes
- Replacing long by size_t in value.hpp
- Use size_t in some Photoshop functions
- Remove some static_casts
3 years ago
Luis Díaz Más 21eb0cec4f Fix build when EXIV2_BUILD_MESSAGES is ON 3 years ago
Luis Díaz Más 8b3da36f42 Improvements from code review 3 years ago
Luis Díaz Más ea201ce613 Remove dead code 3 years ago
Luis Díaz Más a6185d29c6 Image::setComment now takes string_view 3 years ago
Luis Díaz Más 0f03e77634 Simplify code around UniquePtr(s) & use make_unique over new 3 years ago
Josh Soref e56abfa10a
Spelling (#2067)
* spelling: accelerometer

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: address

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: anonymous

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: available

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: baby

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: buffer

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: build

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: builds

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: by inclusion

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: byte order

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: camera

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: command

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: consistency

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: constructor

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: continuous

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: continuously

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: correspond

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: decompression

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: dedicated

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: denominator

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: dependencies

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: detector

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: dlighting

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: dragging

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: duplicate

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: dynamic

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: empty

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: enable

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: endianness

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: examining

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: exceed

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: extension

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: fact

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: fails

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: fixed

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: fluorescent

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: focuspoint

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: focuspoints

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: from

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: happened

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: hierarchy

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: initiate

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: interesting

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: internal

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: javascript

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: language

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: libiconv

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: libraries

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: library

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: localization

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: macros

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: member

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: members

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: metadata

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: miscellaneous

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: mnemonic

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: modified

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: multiple

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: multithreaded

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: mysterious

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: photoshop

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: platforms

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: preliminary

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: priority

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: properties

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: qualifier

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: recognition

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: recognized

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: reentrancy

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: remaining

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: remotetest

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: requested

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: sensitivity

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: standardize

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: successful

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: such

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: tags

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: temperature

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: test

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: the

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: these

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: third

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: this

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: transparent

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: unable

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: underwater

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: uninterpreted

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: using

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: utc - coordinated universal time

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: which

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: with

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>
3 years ago
Kevin Backhouse 68473d9d10
Remove static functions readOrThrow and seekOrThrow. 4 years ago
Kevin Backhouse 44542a9f94
Add readOrThrow and seekOrThrow to BasicIo. 4 years ago
Kevin Backhouse 81cfc162c1
Use std::move to transfer ownership of DataBufs. 4 years ago
Kevin Backhouse 9ff72e5ca5
Make offset=0 the default parameter. 4 years ago
Kevin Backhouse c9d0cf3643
Make fields of DataBuf private. 4 years ago
Kevin Backhouse 5bc444ff00
Use DataBuf rather than raw malloc. 4 years ago
Kevin Backhouse 2b84f4bd64
fix: zero initialize local variables. (#1743)
* Zero initialize local variables.

* Initialize xmpID_
4 years ago
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
4 years ago
Rosen Penev 2c57f214c5 clang-tidy: use nullptr
Found with modernize-use-nullptr

Signed-off-by: Rosen Penev <rosenp@gmail.com>
4 years ago
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>
4 years ago
Rosen Penev c44c289d76 clang-tidy: fix ending namespace comnments
Found with llvm-namespace-comment

Signed-off-by: Rosen Penev <rosenp@gmail.com>
4 years ago
Rosen Penev 743da1a564 clang-tidy: use C++ casting
Found with google-readability-casting

Signed-off-by: Rosen Penev <rosenp@gmail.com>
4 years ago
Rosen Penev b8712188bb clang-tidy: use auto
Found with modernize-use-auto

Signed-off-by: Rosen Penev <rosenp@gmail.com>
4 years ago
Kevin Backhouse ca66136092 Use readOrThrow to check error conditions of iIo.read().
(cherry picked from commit 0f9eb74c44c908e170a64cab590949d53749af8e)
4 years ago
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>
4 years ago
Kevin Backhouse 783b3a6ff1 Improve bound checking in WebPImage::doWriteMetadata() 4 years ago
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
4 years ago
Luis Díaz Más 0bbaa6eff3 cpp: Replace auto_ptr by unique_ptr 4 years ago
Robin Mills d632988bbd Massive code prolog cleanup. 4 years ago
clanmills 2bad338b9d Fix compiler warning on macOS about enforce condition being always true. 5 years ago
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>
6 years ago
Luis Díaz Más 113136e134 Replace DEBUG with EXIV2_DEBUG_MESSAGES
Fixes #926
6 years ago
Kevin Backhouse 6a44698abc Small change to comment. 6 years ago
Kevin Backhouse 3c818f49d9 Revert accidental whitespace change. 6 years ago
Kevin Backhouse 3faeaefbf5 Improve portability of bounds checks. 6 years ago
Kevin Backhouse 86816c0280 Fix signed/unsigned mismatch. 6 years ago
Kevin Backhouse caa4e6745a Avoid negative integer overflow when `filesize < io_->tell()`.
This fixes #791.
6 years ago
Robin Mills a33041a8b7 Fix: https://github.com/Exiv2/exiv2/issues/562 for stringFormat() crashes. 7 years ago
Robin Mills 03b4f1deae Fix: https://github.com/Exiv2/exiv2/issues/580 7 years ago
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
7 years ago
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
7 years ago
Luis Díaz Más b118192f94 Fix cppcheck issues: redundantAssignment 7 years ago
Luis Díaz Más 603692a1d8 Copyright to Exiv2 authors 7 years ago
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
7 years ago
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
7 years ago
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)
7 years ago
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.
7 years ago
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
7 years ago
Dan Čermák efe2ccdcb6 Replaced all hardcoded error codes with ker... constants 7 years ago
tbeu 5b5987a596 Remove obsolete EXIV2_RCSID 8 years ago