Skip to content

Fix/tiff readtiffentry uint32 overflow#3529

Open
blackcaesar0 wants to merge 2629 commits intoExiv2:0.27-maintenancefrom
blackcaesar0:fix/tiff-readtiffentry-uint32-overflow
Open

Fix/tiff readtiffentry uint32 overflow#3529
blackcaesar0 wants to merge 2629 commits intoExiv2:0.27-maintenancefrom
blackcaesar0:fix/tiff-readtiffentry-uint32-overflow

Conversation

@blackcaesar0
Copy link
Copy Markdown

readTiffEntry: offset bounds check wraps on overflow

description:
baseOffset() and offset are both uint32_t so when you add them the
result can wrap. If it wraps to something below size_ the check passes
and pData ends up pointing past the buffer — Value::read() then reads
from memory it has no business touching.

On 64-bit the uintptr_t guard at line 1612 usually saves you. On 32-bit
That guard is the same width so it wraps just the same, Value::read()
dereferences the bad address and you get heap corruption and a SIGSEGV.
I ran into this through kioslave5 crashing on certain JPEGs.

Cast both sides to uint64_t before the addition — wide enough that the
sum of any two uint32_t values can't wrap. I also dropped the second
condition (static_cast<int32_t>(baseOffset()) + offset <= 0) because
the cast doesn't actually change the arithmetic, it just catches the
exact wrap-to-zero case and nothing else.

lines related: #193, #1536

neheb and others added 30 commits May 5, 2025 01:21
It looks like clang-tidy messed up the parentheses here.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Signed-off-by: Rosen Penev <rosenp@gmail.com>
These are already deleted. No need to be explicit.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
found with performance-inefficient-string-concatenation

Signed-off-by: Rosen Penev <rosenp@gmail.com>
This pointer was converted to unique_ptr a while back, which deleted
copying functions anyway. No need for this anymore.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Mo need for the full blown thing.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Should result in slightly faster compilation.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Just like the others

Also add some comments to deletes functions for the same reason.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Simpler.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
They can be generated automatically.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Signed-off-by: Rosen Penev <rosenp@gmail.com>
This prints the ASCII value, not the number. Adding a + avoids the
warning.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Instead of deleting all the subclasses, delete the base.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Localization is not implemented.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Bumps [cygwin/cygwin-install-action](https://github.com/cygwin/cygwin-install-action) from 5 to 6.
- [Release notes](https://github.com/cygwin/cygwin-install-action/releases)
- [Commits](cygwin/cygwin-install-action@v5...v6)

---
updated-dependencies:
- dependency-name: cygwin/cygwin-install-action
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
This might fix bogus MSVC problems with header includes.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
It inherits from std::exception anyway.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
All EXIV2API declarations are in include except for this one, which is
meant to be internal anyway.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
kevinbackhouse and others added 29 commits February 16, 2026 11:14
fix wrong timescale used to calculate fps
Reintroduces lens IDs lost in 8859209. Fixes Exiv2#1420.

Signed-off-by: Miloš Komarčević <miloskomarcevic@aim.com>
(cherry picked from commit ff7bdd6)
Use last versions available for 1.x
(cherry picked from commit 2f14410)
add enforce to prevent integer overflow
Add enforce to check for integer overflow
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 7 to 8.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](actions/download-artifact@v7...v8)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-version: '8'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Bumps [actions/attest-build-provenance](https://github.com/actions/attest-build-provenance) from 3.2.0 to 4.1.0.
- [Release notes](https://github.com/actions/attest-build-provenance/releases)
- [Changelog](https://github.com/actions/attest-build-provenance/blob/main/RELEASE.md)
- [Commits](actions/attest-build-provenance@96278af...a2bbfa2)

---
updated-dependencies:
- dependency-name: actions/attest-build-provenance
  dependency-version: 4.1.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 6 to 7.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](actions/upload-artifact@v6...v7)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
@blackcaesar0 blackcaesar0 requested a review from sridharb1 as a code owner March 20, 2026 05:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.