From de839021dcac3ff8d605a119e4c78f5ccd97c7db Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Sat, 12 Sep 2026 12:04:23 +0200 Subject: [PATCH] rugnux: the whole-spot-list rung does not overflow the cloud's reserve The rung that reads every spot of a frame passes SIZE_MAX as the per-image cap, and the accumulated cloud reserved max_spots_per_image * images - which overflows and throws length_error out of vector::reserve, killing the run. The count held is already tracked exactly, so reserve that. --- image_analysis/rotation_indexer/RotationIndexer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/image_analysis/rotation_indexer/RotationIndexer.cpp b/image_analysis/rotation_indexer/RotationIndexer.cpp index 046d30714..3366777a0 100644 --- a/image_analysis/rotation_indexer/RotationIndexer.cpp +++ b/image_analysis/rotation_indexer/RotationIndexer.cpp @@ -131,7 +131,7 @@ void RotationIndexer::RunIndexing() { return; std::vector coords; - coords.reserve(max_spots_per_image * v_.size()); + coords.reserve(accumulated_spots); // the exact count held; the per-image cap may be SIZE_MAX for (int i = 0; i < v_.size(); i++) { const float angle_deg = angle_deg_[i].value_or(axis_->GetAngle_deg(i) + axis_->GetWedge_deg() / 2.0f); @@ -173,7 +173,7 @@ void RotationIndexer::RunIndexing() { // Re-accumulate the reciprocal spots under a refined geometry/axis, to score a refined cell. auto accumulate = [&](const DiffractionGeometry &g, const std::optional &ax) { std::vector c; - c.reserve(max_spots_per_image * v_.size()); + c.reserve(accumulated_spots); for (int i = 0; i < v_.size(); i++) { const float a = angle_deg_[i].value_or(ax->GetAngle_deg(i) + ax->GetWedge_deg() / 2.0f); const auto rot = ax->GetTransformationAngle(a);