From 89e58b72f067374e7d82fb48344eb64c7ce4e164 Mon Sep 17 00:00:00 2001 From: Verena Reimund <reimund@ill.eu> Date: Mon, 30 Apr 2018 09:40:07 +0200 Subject: [PATCH] Fix missing bound check for sorting the workspace Refs #22197 --- Framework/Algorithms/src/Stitch1D.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Framework/Algorithms/src/Stitch1D.cpp b/Framework/Algorithms/src/Stitch1D.cpp index cc52e672528..80b11d57b61 100644 --- a/Framework/Algorithms/src/Stitch1D.cpp +++ b/Framework/Algorithms/src/Stitch1D.cpp @@ -429,13 +429,15 @@ void Stitch1D::sortXAxis(MatrixWorkspace_sptr &ws) { Mantid::MantidVec vece(ws_size); Mantid::MantidVec vecdx(ws_size); int l = 0; - for (auto it = sorter.cbegin(); it != sorter.cend(); ++it) { + auto it = sorter.cbegin(); + while (it != sorter.cend()) { vecx[l] = it->first; vecy[l] = it->second; vece[l] = (++it)->second; if (ws->hasDx(i)) vecdx[l] = (++it)->second; ++l; + ++it; } auto x = make_cow<HistogramX>(std::move(vecx)); auto y = make_cow<HistogramY>(std::move(vecy)); -- GitLab