mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-27 15:41:00 -05: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
1ee5a037ec
commit
4eccfc86b5
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