Repository navigation
Reject negative scheduling options and integer overflow in delay and clock calculations. - #5359
Draft
copybara-service[bot] wants to merge 1 commit into
Draft
copybara-service[bot] wants to merge 1 commit into
copybara-service[bot] wants to merge 1 commit into
Conversation
copybara-service
Bot
force-pushed
the
test_1019401266
branch
from
November 12, 2026 17:50
286b220 to
6abdb43
Compare
copybara-service
Bot
force-pushed
the
test_1019401266
branch
2 times, most recently
from
November 13, 2026 06:08
6e0a674 to
0afe7d7
Compare
…clock calculations. When `SchedulingOptions` has negative or extreme `int64_t` values (for example from fuzzing `NoFdoSchedulingOptionsFlagsDomain`), negative delays or signed integer overflow when adding path delays, `additional_input_delay_ps`, `additional_output_delay_ps`, `clock_period_ps`, or computing `clock_margin_percent` / `period_relaxation_percent` can cause UB or invalid schedules. - Reject negative delay/margin/relaxation/throughput options and non-positive `clock_period_ps` / `pipeline_stages` with `absl::InvalidArgumentError` in `OptionsFromFlagProto` (`xls/scheduling/scheduling_options.cc`) and `RunPipelineSchedule` (`xls/scheduling/run_pipeline_schedule.cc`). - Detect `int64_t` overflow via `SaturatingAdd(...).did_overflow` (and negative node delays) and return `absl::InvalidArgumentError` instead of saturating in `SDCScheduler`, `ScheduleBounds`, `PipelineSchedule::VerifyTiming`, and `RunPipelineSchedule`. - Update `DecoratingDelayEstimator` (`xls/estimators/delay_model/delay_estimator.h`) to accept `absl::AnyInvocable<absl::StatusOr<int64_t>(Node*, int64_t) const>` so `io_delay_added` in `RunPipelineSchedule` can return `absl::InvalidArgumentError` on negative delays or `int64_t` overflow. - Use `absl::int128` for intermediate products when applying `clock_margin_percent` and `period_relaxation_percent` in `RunPipelineSchedule`, returning `absl::InvalidArgumentError` if the result overflows `int64_t`. - Add unit and FuzzTest regression tests covering near-`INT64_MAX` delays, negative input delays, and large clock periods with non-zero clock margin. PiperOrigin-RevId: 1019401266
copybara-service
Bot
force-pushed
the
test_1019401266
branch
from
November 13, 2026 07:29
0afe7d7 to
61fdf66
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reject negative scheduling options and integer overflow in delay and clock calculations.
When
SchedulingOptionshas negative or extremeint64_tvalues (for example from fuzzingNoFdoSchedulingOptionsFlagsDomain), negative delays or signed integer overflow when adding path delays,additional_input_delay_ps,additional_output_delay_ps,clock_period_ps, or computingclock_margin_percent/period_relaxation_percentcan cause UB or invalid schedules.clock_period_ps/pipeline_stageswithabsl::InvalidArgumentErrorinOptionsFromFlagProto(xls/scheduling/scheduling_options.cc) andRunPipelineSchedule(xls/scheduling/run_pipeline_schedule.cc).int64_toverflow viaSaturatingAdd(...).did_overflow(and negative node delays) and returnabsl::InvalidArgumentErrorinstead of saturating inSDCScheduler,ScheduleBounds,PipelineSchedule::VerifyTiming, andRunPipelineSchedule.DecoratingDelayEstimator(xls/estimators/delay_model/delay_estimator.h) to acceptabsl::AnyInvocable<absl::StatusOr<int64_t>(Node*, int64_t) const>soio_delay_addedinRunPipelineSchedulecan returnabsl::InvalidArgumentErroron negative delays orint64_toverflow.absl::int128for intermediate products when applyingclock_margin_percentandperiod_relaxation_percentinRunPipelineSchedule, returningabsl::InvalidArgumentErrorif the result overflowsint64_t.INT64_MAXdelays, negative input delays, and large clock periods with non-zero clock margin.