mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-17 13:20:45 +00:00
Fix usage of freed memory after check_flood_line() returns true when 8-connectivity is used
This commit is contained in:
parent
c1d5f8eb0a
commit
8efb11915f
@ -393,7 +393,6 @@ void floodfill(const Image* image,
|
||||
|
||||
// For each line on the screen
|
||||
for (int c=0; c<flood_count; c++) {
|
||||
|
||||
p = FLOOD_LINE(c);
|
||||
|
||||
// Check below the segment?
|
||||
@ -446,28 +445,35 @@ void floodfill(const Image* image,
|
||||
check_flood_line(image, mask, p->y-1, p->lpos+1, p->rpos, bounds,
|
||||
src_color, tolerance, data, proc)) {
|
||||
done = false;
|
||||
p = FLOOD_LINE(c);
|
||||
}
|
||||
|
||||
if (p->lpos-1 >= 0 &&
|
||||
check_flood_line(image, mask, p->y-1, p->lpos-1, p->rpos, bounds,
|
||||
src_color, tolerance, data, proc)) {
|
||||
done = false;
|
||||
p = FLOOD_LINE(c);
|
||||
}
|
||||
|
||||
if (p->rpos+1 < bounds.x2() &&
|
||||
check_flood_line(image, mask, p->y-1, p->lpos, p->rpos+1, bounds,
|
||||
src_color, tolerance, data, proc)) {
|
||||
done = false;
|
||||
p = FLOOD_LINE(c);
|
||||
}
|
||||
|
||||
if (p->rpos-1 >= 0 &&
|
||||
check_flood_line(image, mask, p->y-1, p->lpos, p->rpos-1, bounds,
|
||||
src_color, tolerance, data, proc)) {
|
||||
done = false;
|
||||
p = FLOOD_LINE(c);
|
||||
}
|
||||
}
|
||||
|
||||
if (check_flood_line(image, mask, p->y-1, p->lpos, p->rpos, bounds,
|
||||
src_color, tolerance, data, proc)) {
|
||||
done = false;
|
||||
|
||||
// Special case shortcut for going backwards
|
||||
if ((c > bounds.y) && (c < bounds.y2()))
|
||||
c -= 2;
|
||||
|
Loading…
x
Reference in New Issue
Block a user