Fix out of bounds crash in SHAPE_LINE_CHAIN::splitArc

Check that the index references a point that is part of an arc
This commit is contained in:
Roberto Fernandez Bautista 2021-07-05 20:08:46 +01:00
parent f6aaaff81a
commit 72435c78af
1 changed files with 2 additions and 2 deletions

View File

@ -532,12 +532,12 @@ void SHAPE_LINE_CHAIN::Remove( int aStartIndex, int aEndIndex )
aEndIndex = std::min( aEndIndex, PointCount() - 1 ); aEndIndex = std::min( aEndIndex, PointCount() - 1 );
// Split arcs at start index and end just after the end index // Split arcs at start index and end just after the end index
if( aStartIndex < m_points.size() && m_shapes[aStartIndex] != SHAPES_ARE_PT ) if( IsPtOnArc( aStartIndex ) )
splitArc( aStartIndex ); splitArc( aStartIndex );
size_t nextIndex = static_cast<size_t>( aEndIndex ) + 1; size_t nextIndex = static_cast<size_t>( aEndIndex ) + 1;
if( nextIndex < m_points.size() && m_shapes[aEndIndex] != SHAPES_ARE_PT ) if( IsPtOnArc( nextIndex ) )
splitArc( nextIndex ); splitArc( nextIndex );
std::set<size_t> extra_arcs; std::set<size_t> extra_arcs;