Commit Graph

129 Commits

Author SHA1 Message Date
Kevin Backhouse
0c3da129f2
Replace assert with enforce. (Fix for https://github.com/Exiv2/exiv2/issues/2268) 2022-07-07 17:31:38 +01:00
Kevin Backhouse
1ada360774 Fix some incorrect format specifiers. 2022-07-05 10:54:19 -07:00
Kevin Backhouse
ad4e13b827
Change return type of BasicIo::tell() to size_t. 2022-06-21 17:05:10 +01:00
Luis Díaz Más
941017d281
Fix issues on ARM builds (#2205)
* Specify base class initialization in Copy Constructor

* Fix printing of uint64_t variable in ARM 32bits

Use cinttypes

* Fix alignment issues on ARM 32 bits

* tests: add assertion with custom message
2022-04-13 15:22:22 +02:00
Rosen Penev
0d971e98e4 remove some unique_ptrs
They're not really used as pointers.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2022-04-10 01:40:34 -07:00
Luis Díaz Más
ae4df71233 Remove DataBuf::copyBytes and use std::copy instead 2022-03-23 17:17:29 +01:00
Luis Díaz Más
1ad9e52f3c Fix windows build 2022-03-18 15:07:45 +01:00
Luis Díaz Más
1545a1bc4a JP2 - stronger checks on Signatuer and FileType boxes 2022-03-18 14:55:16 +01:00
Luis Díaz Más
e7478f744d Jp2Image: Implement more checks from JP2 standard + fix bug
- add debug info when parsing Signature box
- Move definitions & static stuff to anonymous namespace
- cleanup while studying code
- Make exceptions more similar to other formats
2022-03-18 14:37:07 +01:00
Luis Diaz
b48e8e9379 Add unit tests for Jp2Image revealing bugs (see #2147) 2022-03-18 14:36:35 +01:00
Luis Díaz Más
30bf563f4d Update .clang-format file & apply clang-format to whole project 2022-03-16 22:30:53 +01:00
Rosen Penev
b2b6d834ba
some std::array conversions (#2148)
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2022-03-15 10:17:06 +01:00
Luis Diaz
7576a2757b More size_t for sizes 2022-03-14 11:50:42 +01:00
Luis Díaz Más
96f7f2e4c5 Convert Exiv2::ErrorCode into an enum class 2022-03-12 16:58:40 +01:00
Luis Díaz Más
f894ee0568 Fix debug builds 2022-03-08 10:13:22 +01:00
Luis Díaz Más
f156af46f3 Fix build on Windows 2022-03-07 22:25:51 +01:00
Luis Díaz Más
8b1fe379a1 Removing unused headers thanks to IWYU 2022-03-07 22:25:47 +01:00
Rosen Penev
6d1fa2ecea clang-tidy: use empty() instead of size()
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2022-03-05 16:21:26 -08:00
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
2022-03-04 11:44:39 +01:00
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
2022-02-27 09:41:47 +01:00
Luis Díaz Más
5d627433fc Remove useless DataBuf::clear() 2022-02-27 09:36:46 +01:00
Luis Díaz Más
8b3da36f42 Improvements from code review 2022-02-19 17:27:29 +01:00
Luis Díaz Más
ea201ce613 Remove dead code 2022-02-18 18:01:02 +01:00
Luis Díaz Más
a6185d29c6 Image::setComment now takes string_view 2022-02-18 18:01:02 +01:00
Luis Díaz Más
0f03e77634 Simplify code around UniquePtr(s) & use make_unique over new 2022-02-05 11:02:04 +01:00
Kevin Backhouse
81cfc162c1
Use std::move to transfer ownership of DataBufs. 2021-10-10 23:56:00 +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
ffde235336
Add comment to explain the bounds-check. 2021-08-01 23:27:03 +01:00
Kevin Backhouse
67e2ef5ccd
Check size before allocation to avoid out-of-memory errors. 2021-08-01 23:27:02 +01:00
Kevin Backhouse
ff00771425 Better bounds checking in Jp2Image::printStructure
(cherry picked from commit 0fcdde80997913dde284ea98f06f9305d06cb160)
2021-07-05 22:43:13 +02:00
Kevin Backhouse
d30c95d07e fix incorrect loop condition (#1752) 2021-07-01 19:21:45 +02: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
Rosen Penev
c73dfa0106 clang-tidy: use uppercase numeric literals
Found with readability-uppercase-literal-suffix

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-05-16 11:27:49 +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
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