116 Commits (ced25a5d56acb79a5b4c7a8bad6364323529bfd1)

Author SHA1 Message Date
Kevin Backhouse c641116b25
Add static_cast to fix build error on Windows. 4 years ago
Kevin Backhouse b8ed3867c0
Use DataBuf, rather than new[], for automatic delete when an exception is throw. 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
Christoph Hasse 758dd6bbc6 refactor!: remove free() function from DataBuf to avoid potential problems, see #1542 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 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
Rosen Penev 8e178e912e replace {} initialization with fill
Old compilers don't implement {} correctly.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
4 years ago
Rosen Penev fdf9d3799c clang-tidy: don't use else after return
Found with llvm-else-after-return

Signed-off-by: Rosen Penev <rosenp@gmail.com>
4 years ago
Rosen Penev 9642e3cceb clang-tidy: remove pointless string init
Found with readability-redundant-string-init

Signed-off-by: Rosen Penev <rosenp@gmail.com>
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
Rosen Penev 1dc1186760 clang-tidy: simplify boolean expressions
Found with readability-simplify-boolean-expr

Signed-off-by: Rosen Penev <rosenp@gmail.com>
4 years ago
Rosen Penev 4ceb325c8f clang-tidy: range for loop conversions
Found with modernize-loop-convert

Ran through git clang-format.

Also removed several questionable loops and replaced with simpler
algorithms.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
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 9fa6d3965a C++ changes requested by @piponazo. Fix python png_test() recommended by @LeoHsiao1. Update reference output. 5 years ago
clanmills 834dca39d0 Code changes 5 years ago
clanmills 7383d96d47 Fix compiler error when using EXIV2_DEBUG_MESSAGES. 5 years ago
Luis Díaz Más 113136e134 Replace DEBUG with EXIV2_DEBUG_MESSAGES
Fixes #926
6 years ago
Kevin Backhouse 6068df4c01 Add better bounds checking in PngImage::printStructure(). (#862) 6 years ago
Kevin Backhouse 8cd95e2218 Avoid negative integer overflow when `chunkLength == 0`.
This fixes #789.
6 years ago
Kevin Backhouse 6fa2e31206 Avoid negative integer overflow when `iccOffset > chunkLength`.
This fixes #790.
6 years ago
Luis Diaz Mas 127c2eac0e Fix warnings on MSVC 6 years ago
Luis Díaz Más 704fc56d52 Keep the profileName from readMetadata and use it in writeMetadata 6 years ago
Luis Díaz Más e385599067 Refactoring to make the doe more readable. Fix icc tests 6 years ago
Luis Díaz Más d1097fab59 Factor our function to read PNG Chunk info 6 years ago
Luis Díaz Más 914a8c5585 Factor out exception throw in different places inside isPngType 6 years ago
Luis Diaz Mas 88f22e13cb Fix ICC profile in PNG images 7 years ago
Dan Čermák 962962a8e9 Port Iptc::printStructure & getUshort to slices API
This fixes #211, #210, #209
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 603692a1d8 Copyright to Exiv2 authors 7 years ago
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_
7 years ago
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.
7 years ago
Dan Čermák 607b19111c [DataBuf] Replace wrong usage of release() with free() 7 years ago
Luis Diaz Mas a227fcda39 debug: Add new debug message to print the PNG chunk being processed 7 years ago
Luis Diaz Mas b0696d4da6 style: Apply formatting guidelines to one-line ifs 7 years ago
Luis Diaz Mas 4922df6018 Replace '\n' by endl that flush content. Useful for debugging 7 years ago
Dan Čermák 751fba8b54 Added dataBuf size check before calling PngChunk::decodeIHDRChunk
- cdataBuf must be at least 8 bytes long otherwise decodeIHDRChunk
  reads out of bounds
- pngImage::readMetadata now skips png chunks where the offset for
  IHDR chunks is invalid
- added assertion into PngChunk::decodeIHDRChunk() to ensure dataBuf
  size
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
tbeu 5df8b01b77 Remove obsolete svn revision 8 years ago
clanmills 327b3f6c4d Fix https://github.com/Exiv2/exiv2/issues/83 8 years ago
Robin Mills 82dbe6199d https://github.com/Exiv2/exiv2/issues/11 Closed. Coincidentally Raphael reported issues with Visual Studio 2015 Community Edition. Issue 11 and Raphael's issues should now be resolved. 8 years ago
Robin Mills 6d5c2c3256 Getting ready to release v0.26 8 years ago
Robin Mills 2ebacb6b0b #1272 Use in-memory temporary files. 8 years ago
Robin Mills f5956d5db2 #1230 Fixes to read tiff with web-ready. Includes the BasicIo expiremental API readUnmarked() and markRead() which I will remove later. 9 years ago
Robin Mills 5b38d4528a #1108 Added code to dump Exif, IPTC and iTXt/zTXt comment/description blocks for PNG files. 9 years ago
Robin Mills 793bd6ca63 #1109 MinGW/32 daily build. Fix GCC warning on MinGW/32 gcc 4.9.2 9 years ago
Robin Mills d321dad695 #1108 Fixing issue with pngimage::printStructure() and the "Software" string in test/data/imagemagick.png 9 years ago