Skip to content

fix: prevent integer overflow when computing oca stop time - #3174

Merged
davisking merged 1 commit into
davisking:masterfrom
lippinj:upstream-fix-5
Oct 17, 2026
Merged

davisking merged 1 commit into
davisking:masterfrom
lippinj:upstream-fix-5

Conversation

@lippinj

@lippinj lippinj commented Oct 16, 2026

Copy link
Copy Markdown

Adding a large max_runtime duration to steady_clock::now() can overflow on platforms where the clock epoch is large (observed on macOS with GCC), wrapping time_to_stop to a value in the past and causing an immediate early exit.

When computing time_to_stop, use a saturating addition instead.

Adding a large max_runtime duration to steady_clock::now() can overflow
on platforms where the clock epoch is large (observed on macOS with GCC),
wrapping time_to_stop to a value in the past and causing an immediate
early exit.

Fix the computation site: clamp time_to_stop to time_point::max() if
the addition would overflow, rather than capping the default duration.

Copy link
Copy Markdown
Owner

Thanks @lippinj for catching the OCA deadline overflow. I verified the overflow case and timeout boundaries; this looks good as submitted.

@davisking
davisking merged commit c58f261 into davisking:master Oct 17, 2026
13 checks passed
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