Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit eda0cbd

Browse files
authored
Initialize members of PathClipper and check for m_has_init
MemorySanitizer complains about use-of-uninitialized-value in one of my tests. WARNING: MemorySanitizer: use-of-uninitialized-value [....]src/path_converters.h:425:42 in PathClipper<PathNanRemover<agg::conv_transform<py::PathIterator, agg::trans_affine> > >::vertex(double*, double*)
1 parent 8dd2838 commit eda0cbd

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/path_converters.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,11 @@ class PathClipper : public EmbeddedQueue<3>
306306
: m_source(&source),
307307
m_do_clipping(do_clipping),
308308
m_cliprect(-1.0, -1.0, width + 1.0, height + 1.0),
309+
m_lastX(nan("")),
310+
m_lastY(nan("")),
309311
m_moveto(true),
312+
m_initX(nan("")),
313+
m_initY(nan("")),
310314
m_has_init(false)
311315
{
312316
// empty
@@ -316,7 +320,11 @@ class PathClipper : public EmbeddedQueue<3>
316320
: m_source(&source),
317321
m_do_clipping(do_clipping),
318322
m_cliprect(rect),
323+
m_lastX(nan("")),
324+
m_lastY(nan("")),
319325
m_moveto(true),
326+
m_initX(nan("")),
327+
m_initY(nan("")),
320328
m_has_init(false)
321329
{
322330
m_cliprect.x1 -= 1.0;
@@ -432,7 +440,7 @@ class PathClipper : public EmbeddedQueue<3>
432440
return code;
433441
}
434442

435-
if (m_moveto &&
443+
if (m_moveto && m_has_init &&
436444
m_lastX >= m_cliprect.x1 &&
437445
m_lastX <= m_cliprect.x2 &&
438446
m_lastY >= m_cliprect.y1 &&

0 commit comments

Comments
 (0)