Skip to content

#14632 Guard against out-of-range time step index when loading results - #14633

Merged
magnesj merged 1 commit into
devfrom
soil-statistics-timestep-bounds-14632
Aug 28, 2026
Merged

#14632 Guard against out-of-range time step index when loading results#14633
magnesj merged 1 commit into
devfrom
soil-statistics-timestep-bounds-14632

Conversation

@magnesj

@magnesj magnesj commented Aug 27, 2026

Copy link
Copy Markdown
Member

Fixes #14632

A case in an ensemble can have fewer time steps than the case defining the time step axis of a statistics case. findOrLoadKnownScalarResultForTimeStep used the requested time step index to index m_cellScalarResults directly, reading past the end of the vector in Release where CAF_ASSERT is a no-op. Return cvf::UNDEFINED_SIZE_T instead, the existing "result not available" return, so every caller is protected and not only the statistics evaluator.

Guards added to the SOIL and SGAS branches and to the generic dynamic native branch. RigSoilResultCalculator returns early when the source saturation is empty for the time step, avoiding a resize( 0 ) that discarded SOIL already computed for other time steps, and checks the result index like RigSgasResultCalculator already does.

@magnesj magnesj self-assigned this Aug 27, 2026
@magnesj
magnesj requested a review from kriben August 27, 2026 13:50

@kriben kriben left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@magnesj
magnesj force-pushed the soil-statistics-timestep-bounds-14632 branch from a6efe4b to a614829 Compare August 28, 2026 05:10
A case in an ensemble can have fewer time steps than the case defining the time step axis of a statistics case. The time step index was used to index m_cellScalarResults directly, reading past the end of the vector in Release where CAF_ASSERT is a no-op.
@magnesj
magnesj force-pushed the soil-statistics-timestep-bounds-14632 branch from a614829 to aef6e18 Compare August 28, 2026 05:12
@magnesj
magnesj merged commit 5f0c3f8 into dev Aug 28, 2026
19 checks passed
@magnesj
magnesj deleted the soil-statistics-timestep-bounds-14632 branch August 28, 2026 05:15
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.

Grid statistics: Out-of-range time step index when a source case has fewer time steps than the first case

2 participants