freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Devel] freetype raster overflow detection bug found


From: Yong Sun
Subject: [Devel] freetype raster overflow detection bug found
Date: Tue, 13 May 2003 23:18:15 +1000

freetype source bug found in 
file: freetype214/src/raster/Ftraster.c
function:  Insert_Y_Turn( RAS_ARGS Int  y )
bug description: 
        original code detects the overflow before changing the maxBuff.
        it should detect after changing the maxBuff
===============================================================
original: 
===============================================================
    if ( n < 0 )
    {
      if ( ras.maxBuff <= ras.top )
      {
        ras.error = Raster_Err_Overflow;
        return FAILURE;
      }
      ras.maxBuff--;
      ras.numTurns++;
      ras.sizeBuff[-ras.numTurns] = y;
    }

    return SUCCESS;

==============================================================
modified:   move "ras.maxBuff--" before "if ..."
===============================================================
    if ( n < 0 )
    {
      ras.maxBuff--;
      if ( ras.maxBuff <= ras.top )
      {
        ras.error = Raster_Err_Overflow;
        return FAILURE;
      }
      ras.numTurns++;
      ras.sizeBuff[-ras.numTurns] = y;
    }

    return SUCCESS; 

  Yong Sun <address@hidden>
+--------------------------------------------------------------------+
* NJStar Software Corp., P.O. Box 40,  Epping NSW 2121, Australia.   
* ~{DO<+PGHm<~9+K>~}           
* Fax: +61-2-9869-1099    Email:    address@hidden                  
* Tel: +61-2-9869-1088    Web Site: http://www.njstar.com            
*--------------------------------------------------------------------*




reply via email to

[Prev in Thread] Current Thread [Next in Thread]