Commit Graph

94 Commits

Author SHA1 Message Date
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
170b18db74
Merge pull request #1621 from Exiv2/mergify/bp/main/pr-1591
Fix infinite loop caused by subBox with zero size. (backport #1591)
2021-05-11 12:28:03 +01:00
Kevin Backhouse
566ea272a1 Prevent large allocation.
(cherry picked from commit f154f0ae540deeb9251467187d01c2a5846d27b5)
2021-05-10 15:55:35 +02:00
Kevin Backhouse
aac34630d4 Fix infinite loop caused by subBox with zero size.
(cherry picked from commit 2736126e7b92c5654f56620c097f9a4580c0f73b)
2021-05-10 09:06:19 +00:00
Rosen Penev
1dc1186760 clang-tidy: simplify boolean expressions
Found with readability-simplify-boolean-expr

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-05-09 17:30:46 +02:00
Kevin Backhouse
57cad2619b Add bounds check in Jp2Image::doWriteMetadata().
(cherry picked from commit e6a0982f7cd9282052b6e3485a458d60629ffa0b)
2021-05-08 11:00:57 +00:00
Kevin Backhouse
b3de96f4b4 Add more bounds checks in Jp2Image::encodeJp2Header 2021-04-22 21:14:50 +02:00
Kevin Backhouse
23c1cda99d Fix signed/unsigned compiler warnings. 2021-04-20 21:19:51 +02:00
Kevin Backhouse
f930883919 Better bounds checking in Jp2Image::encodeJp2Header() 2021-04-20 21:19:51 +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
Robin Mills
d73dd0874d Fix icc_test which is failing on Linux:
luis@ryzenLinux:/media/linuxDev/programming/exiv2/buildReleaseSanitizers$ cp large.icc Reagan2.icc
luis@ryzenLinux:/media/linuxDev/programming/exiv2/buildReleaseSanitizers$ bin/exiv2 -iC /tmp/Reagan2.jp2
/media/linuxDev/programming/exiv2/src/jp2image.cpp:661:28: runtime error: reference binding to misaligned address 0x61f000002a9e for type 'const struct Jp2BoxHeader', which requires 4 byte alignment
0x61f000002a9e: note: pointer points here
 07 07 01 00 00 00  0c 53 63 6f 6c 72 02 00  00 00 00 0c 48 4c 69 6e  6f 02 10 00 00 6d 6e 74  72 52
2021-04-18 09:46:47 +02:00
Luis Díaz Más
0bbaa6eff3 cpp: Replace auto_ptr by unique_ptr 2021-04-15 06:56:11 +02:00
Pydera
13e5a3e023 Fix out of buffer access in #1529 2021-04-08 20:58:32 +02:00
Robin Mills
22ea582c6b fix_1522_jp2image_exif_asan 2021-04-05 20:33:25 +01:00
Robin Mills
d632988bbd Massive code prolog cleanup. 2021-03-17 13:34:21 +00:00
Robin Mills
22ed9b157b Fixed typo declaration of pad when writing ICC profile. 2020-07-08 13:51:51 +01:00
Robin Mills
181dd47385 Fix correctly this time and tested with the user files. Test suite updated to use Reagan2.jp2 2020-07-07 18:56:18 +01:00
Robin Mills
b91de7acd0 fix_1236_0.27 2020-07-06 20:52:29 +01:00
clanmills
1b917c3f7d Fix #1011 fix_1011_jp2_readmetadata_loop 2019-10-05 07:50:59 +02:00
Luis Díaz Más
113136e134 Replace DEBUG with EXIV2_DEBUG_MESSAGES
Fixes #926
2019-07-12 11:14:35 +02:00
Luis Díaz Más
51f3910413 [jp2image] Limit data representation to 30 bytes
- fixes #744
2019-04-09 01:09:20 +02:00
D4N
adfc01f2e0 Update tests/bugfixes/github/test_issue_742.py
Co-Authored-By: piponazo <piponazo@gmail.com>
(cherry picked from commit 39d8904696338d5bd4a9c7e9a96a798a791d0973)
2019-04-07 18:06:42 +02:00
Luis Diaz Mas
25ddbaa6c0 Make subBox.length check in jp2image.cpp more robust
(cherry picked from commit a154b992ccad71a7d95a94cdedb933fa66a51b61)
2019-04-07 18:06:42 +02:00
Luis Díaz Más
8c81e1146c clang-format Jp2Image::printStructure()
(cherry picked from commit b6e4ca0a8cfff1ad0f6040901382863cccee33cb)

# Conflicts:
#	src/jp2image.cpp
2019-04-07 18:06:42 +02:00
Luis Díaz Más
051b5d9df1 Fix #742 by detecting incorrect subBox size
(cherry picked from commit 1bdd3eab5ebdde324dbfecc3fb6d6495b32d2e4d)
2019-04-07 18:06:42 +02:00
Luis Díaz Más
436b0f87b5 Add missing header when -DDEBUG is present 2019-01-24 21:28:49 +01:00
Robin Mills
a33041a8b7 Fix: https://github.com/Exiv2/exiv2/issues/562 for stringFormat() crashes. 2018-12-09 18:54:40 +01:00
Dan Čermák
962962a8e9 Port Iptc::printStructure & getUshort to slices API
This fixes #211, #210, #209
2018-10-11 14:06:16 +02: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
Roberto C. Sánchez
c03f73268f Prevent SIGABRT on excessive subBox length in jp2image.cpp
This fixes CVE-2018-9145
2018-10-10 11:52:39 +02:00
Luis Díaz Más
603692a1d8 Copyright to Exiv2 authors 2018-09-12 19:22:31 +02:00
Luis Díaz Más
ffbcaa2e6d Fix MSVC warning C4267: conversion from 'size_t' to 'long' 2018-04-09 15:54:27 +02:00
Dan Čermák
efe2ccdcb6 Replaced all hardcoded error codes with ker... constants 2018-02-18 09:28:57 +01:00
Dan Čermák
fcb4257051 Add check for DataBuf.size_ in Jp2Image::readMetadata()
When parsing a subBox that is a ColorHeader, a length is extracted
from the input file and fed directly into DataBuf() (which calls
malloc). A crafted input file can provide arbitrarily (up to
max(uint32_t)-8) large values and result in excessive memory
allocation.

This commit adds a check for the new size of DataBuf so that it is not
larger than the remaining size of the file.

This fixes #202 aka CVE-2018-4868
2018-02-01 17:55:22 +01:00
Luis Diaz Mas
d09c4bb7cd Fix arithmetic operation overflow 2017-12-21 16:33:14 +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
Robin Mills
e96e0daa8a Jp2Image::printStructure: Corrected used DataBuf for output 2017-11-19 08:29:06 +01:00
Robin Mills
befe8c64e3 Jp2Image::printStructure: only print output when bPrint is set 2017-11-19 08:29:06 +01:00
Robin Mills
13db7fdec2 Formatting changes 2017-11-19 08:29:06 +01:00
Dan Čermák
ff18fec24b Fix for CVE-2017-14860
A heap buffer overflow could occur in memcpy when icc.size_ is larger
than data.size_ - pad, as then memcpy would read out of bounds of data.

This commit adds a sanity check to iccLength (= icc.size_): if it is
larger than data.size_ - pad (i.e. an overflow would be caused) an
exception is thrown.

This fixes #71.
2017-10-11 00:11:15 +02:00
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. 2017-06-29 22:13:26 +01:00
Robin Mills
44da4724b3 #1175 Correction to r4756 Another three casts required to build with Visual Studio (size_t code ripple) 2017-04-23 10:58:54 +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
dd0a22814c #1247 Another correction to r4655 concerning clang/apple. 2016-10-31 18:42:32 +00:00
Robin Mills
9853ca55bd #1247. Correction to r4655 to handle clang on plaforms other than MacOS-X. 2016-10-31 18:21:00 +00:00
Robin Mills
92659f24c8 #1247 Restrict clang pragma to __APPLE__ 2016-10-21 19:24:48 +00:00
Robin Mills
4abb560cf7 #1243. Fixing compilation warnings from clang in jp2image.cpp 2016-10-21 19:20:32 +00:00
Robin Mills
764f079dff #1243 Fixing typo/build breaker. 2016-10-21 17:58:10 +00:00