Browse Source

Add bounds checking when slicing SHAPE_LINE_CHAIN from the middle of the last arc.

(and said arc is the last shape in the chain)

Fixes https://gitlab.com/kicad/code/kicad/-/issues/18391
jobs
Alex Shvartzkop 1 year ago
parent
commit
63eac0382c
  1. 2
      libs/kimath/src/geometry/shape_line_chain.cpp

2
libs/kimath/src/geometry/shape_line_chain.cpp

@ -1481,7 +1481,7 @@ const SHAPE_LINE_CHAIN SHAPE_LINE_CHAIN::Slice( int aStartIndex, int aEndIndex )
const SHAPE_ARC& arcToSplit = Arc( arcToSplitIndex );
// Copy the points as arc points
for( size_t i = aStartIndex; arcToSplitIndex == ArcIndex( i ); i++ )
for( size_t i = aStartIndex; i < m_points.size() && arcToSplitIndex == ArcIndex( i ); i++ )
{
rv.m_points.push_back( m_points[i] );
rv.m_shapes.push_back( { rv.m_arcs.size(), SHAPE_IS_PT } );

Loading…
Cancel
Save