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

Skip to content

Commit 5e94e9e

Browse files
committed
Remove possibility of buffer overrun in last commit.
svn path=/trunk/matplotlib/; revision=5776
1 parent 0c76736 commit 5e94e9e

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

src/agg_py_path_iterator.h

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,18 @@ class PathIterator
7575
{
7676
if (m_iterator >= m_total_vertices) return agg::path_cmd_stop;
7777
unsigned code = vertex_with_code(m_iterator++, x, y);
78+
7879
if (MPL_isnan64(*x) || MPL_isnan64(*y)) {
79-
do {
80-
vertex(m_iterator++, x, y);
81-
} while ((MPL_isnan64(*x) || MPL_isnan64(*y)) &&
82-
m_iterator < m_total_vertices);
83-
return (m_iterator >= m_total_vertices) ? agg::path_cmd_stop :
84-
agg::path_cmd_move_to;
80+
do {
81+
if (m_iterator < m_total_vertices) {
82+
vertex(m_iterator++, x, y);
83+
} else {
84+
return agg::path_cmd_stop;
85+
}
86+
} while (MPL_isnan64(*x) || MPL_isnan64(*y));
87+
return agg::path_cmd_move_to;
8588
}
89+
8690
return code;
8791
}
8892

0 commit comments

Comments
 (0)