Skip to content

Commit

Permalink
Fix AGG crash when rendering extremely long horizontal lines.
Browse files Browse the repository at this point in the history
When AGG rasterizes a horizontal line, it has code to check if the
computations will overflow its fixed-precision coordinate math. If an
hline is too wide, it will subdivide the line into two pieces until the
overflow is avoided.

Except a `return` statement was missing, so overflow-y code ran as well
as the subdivided code! Leading to negative coordinates and a crash.
This only happens for lines that span more than something like 32768
pixels in the X direction, so it's not something that happens in regular
usage.
  • Loading branch information
pkgw committed Jan 1, 2021
1 parent 5b89c9c commit c4bf0ae
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions extern/agg24-svn/include/agg_rasterizer_cells_aa.h
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ namespace agg
int cy = (y1 + y2) >> 1;
line(x1, y1, cx, cy);
line(cx, cy, x2, y2);
return;
}

int dy = y2 - y1;
Expand Down

0 comments on commit c4bf0ae

Please sign in to comment.