Fixed a memory corruption issue in db::rasterize

This commit is contained in:
Matthias Koefferlein 2021-03-07 11:26:54 +01:00
parent 6e6ce998aa
commit d76fc02244
1 changed files with 5 additions and 1 deletions

View File

@ -1687,6 +1687,10 @@ rasterize (const db::Polygon &polygon, db::AreaMap &am)
++c;
}
if (c == edges.end ()) {
return;
}
std::vector <db::Edge>::iterator f = c;
for (size_t iy = iy0; iy < iy1; ++iy) {
@ -1704,7 +1708,7 @@ rasterize (const db::Polygon &polygon, db::AreaMap &am)
std::vector <db::Edge>::iterator cc = c;
while (cc != edges.end () && db::edge_xmax (*cc) <= x) {
while (cc != edges.end () && cc != f && db::edge_xmax (*cc) <= x) {
db::Coord y1 = std::max (y, std::min (yy, cc->p1 ().y ()));
db::Coord y2 = std::max (y, std::min (yy, cc->p2 ().y ()));
a += area_type (dx) * area_type (y2 - y1);