prevent a 16-bit integer overflow that would create problems when rendering

*very* large anti-aliased outlines
This commit is contained in:
David Turner 2007-06-16 16:40:37 +00:00
parent e9f4799940
commit 6c2ab0977c
2 changed files with 19 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2006-06-16 David Turner <david@freetype.org>
* src/smooth/ftgrays.c (gray_hline): prevent integer overflows
when rendering *very* large outlines
2006-06-16 Dmitry Timoshkov <dmitry@codeweavers.com>
* src/winfonts/winfnt.h: Add necessary structures for PE resource

View File

@ -397,6 +397,8 @@
PCell *pcell, cell;
int x = ras.ex;
if (x > ras.max_ex)
x = ras.max_ex;
pcell = &ras.ycells[ras.ey];
for (;;)
@ -462,6 +464,10 @@
/* All cells that are on the left of the clipping region go to the */
/* min_ex - 1 horizontal position. */
ey -= ras.min_ey;
if (ex > ras.max_ex)
ex = ras.max_ex;
ex -= ras.min_ex;
if ( ex < 0 )
ex = -1;
@ -492,6 +498,9 @@
gray_start_cell( RAS_ARG_ TCoord ex,
TCoord ey )
{
if ( ex > ras.max_ex )
ex = (TCoord)( ras.max_ex );
if ( ex < ras.min_ex )
ex = (TCoord)( ras.min_ex - 1 );
@ -1196,6 +1205,10 @@
y += (TCoord)ras.min_ey;
x += (TCoord)ras.min_ex;
/* FT_Span.x is a 16-bit short, so limit our coordinates appropriately */
if (x >= 32768)
x = 32767;
if ( coverage )
{
/* see whether we can add this span to the current list */