Skip to content

Security: Integer Overflow in Chirp Size Calculation#321

Open
tomaioo wants to merge 1 commit into
isce-framework:developfrom
tomaioo:fix/security/integer-overflow-in-chirp-size-calculati
Open

Security: Integer Overflow in Chirp Size Calculation#321
tomaioo wants to merge 1 commit into
isce-framework:developfrom
tomaioo:fix/security/integer-overflow-in-chirp-size-calculati

Conversation

@tomaioo

@tomaioo tomaioo commented Jun 19, 2026

Copy link
Copy Markdown

Summary

Security: Integer Overflow in Chirp Size Calculation

Problem

Severity: Medium | File: cxx/isce3/focus/Chirp.cpp:L28

In Chirp.cpp, the code checks if d_size > d_maxsize before converting to int, but uses std::floor(d_size) which returns a double. The check d_size > d_maxsize where d_maxsize = numeric_limits::max() is not sufficient to prevent all overflow cases due to floating-point precision issues. A very large double value near INT_MAX could pass the check but still overflow when converted to int.

Solution

Use a more robust overflow check. Instead of comparing doubles values, check if d_size > static_cast(std::numeric_limits::max()) or use std::numeric_limits::max() directly as the threshold. Consider using size_t for the size variable instead of int to avoid the overflow entirely.

Changes

  • cxx/isce3/focus/Chirp.cpp (modified)

In Chirp.cpp, the code checks if d_size > d_maxsize before converting to int, but uses std::floor(d_size) which returns a double. The check d_size > d_maxsize where d_maxsize = numeric_limits<int>::max() is not sufficient to prevent all overflow cases due to floating-point precision issues. A very large double value near INT_MAX could pass the check but still overflow when converted to int.

Signed-off-by: tomaioo <203048277+tomaioo@users.noreply.github.com>
@piyushrpt

Copy link
Copy Markdown
Contributor

This appears to be a bot that has been opening single line PRs in multiple repositories today

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.

2 participants