check m_width_abs > 0 to avoid division by zero (-fsanitize=undefined)

This commit is contained in:
Artem Pavlenko 2018-02-13 17:05:12 +01:00
parent 2a594d4f0e
commit 533c6d6e5b

View file

@ -391,12 +391,12 @@ namespace agg
vc.remove_all();
double cp = cross_product(v0.x, v0.y, v1.x, v1.y, v2.x, v2.y);
if(cp != 0 && (cp > 0) == (m_width > 0))
if (cp != 0 && (cp > 0) == (m_width > 0) && m_width_abs > 0)
{
// Inner join
//---------------
double limit = ((len1 < len2) ? len1 : len2) / m_width_abs;
if(limit < m_inner_miter_limit)
if (limit < m_inner_miter_limit)
{
limit = m_inner_miter_limit;
}