Avoid overflow in textbox

Count() returns unsigned values.  Since, we subtract 1 from this value,
if the count is 0, we will underflow the unsigned value, creating an
extremely large value that we multiply by the interline spacing.
This commit is contained in:
Seth Hillbrand 2022-02-25 11:04:36 -08:00
parent 3801a8adc0
commit d29d981784
1 changed files with 3 additions and 1 deletions

View File

@ -316,6 +316,8 @@ EDA_RECT EDA_TEXT::GetTextBox( int aLine, bool aInvertY ) const
// interline spacing is only *between* lines, so total height is the height of the first
// line plus the interline distance (with interline spacing) for all subsequent lines
// Don't add interline spacing to empty textboxes
if( strings.GetCount() )
textsize.y += KiROUND( ( strings.GetCount() - 1 ) * interline );
}