mirror of
https://github.com/OPM/ResInsight.git
synced 2026-11-01 08:38:00 -06:00
Make sure std::equal is executed on valid range of vectors
Previous solution did not check for equal length of these vectors, causing out of bounds compare. Detected by debug build using MSVC
This commit is contained in:
1 parent
afe2434b63
commit
27556f36ae
1 file changed
+3
-10
@@ -77,16 +77,9 @@ void RiaCurveMerger<XValueType>::addCurveData( const std::vector<XValueType>& xV
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( m_isXValuesSharedBetweenCurves )
|
||||
{
|
||||
const auto& firstXValues = m_originalValues.front().first;
|
||||
m_isXValuesSharedBetweenCurves = std::equal( firstXValues.begin(), firstXValues.end(), xValues.begin() );
|
||||
}
|
||||
|
||||
if ( m_isXValuesMonotonicallyIncreasing )
|
||||
{
|
||||
m_isXValuesMonotonicallyIncreasing = isMonotonicallyIncreasing( xValues );
|
||||
}
|
||||
const auto& firstXValues = m_originalValues.front().first;
|
||||
m_isXValuesSharedBetweenCurves &= std::equal( firstXValues.begin(), firstXValues.end(), xValues.begin(), xValues.end() );
|
||||
m_isXValuesMonotonicallyIncreasing &= isMonotonicallyIncreasing( xValues );
|
||||
}
|
||||
m_originalValues.push_back( std::make_pair( xValues, yValues ) );
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user