freetype-commit
[Top][All Lists]
Advanced

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

[Git][freetype/freetype][master] [woff2] Fix memory leak.


From: Werner Lemberg
Subject: [Git][freetype/freetype][master] [woff2] Fix memory leak.
Date: Thu, 25 Feb 2021 19:01:55 +0000

Werner Lemberg pushed to branch master at FreeType / FreeType

Commits:

2 changed files:

Changes:

  • ChangeLog
    1
    +2021-02-25  Werner Lemberg  <wl@gnu.org>
    
    2
    +
    
    3
    +	[woff2] Fix memory leak.
    
    4
    +
    
    5
    +	Reported as
    
    6
    +
    
    7
    +	  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=28148
    
    8
    +
    
    9
    +	* src/sfnt/sfwoff2.c (woff2_open_font): Reject fonts that have
    
    10
    +	multiple tables with the same tag.  While not explicitly forbidden
    
    11
    +	in the OpenType specification, it is implicitly forbidden by
    
    12
    +	describing a binary search algorithm for tables that only works
    
    13
    +	reliably if table tags are unique.
    
    14
    +
    
    1 15
     2021-02-22  Werner Lemberg  <wl@gnu.org>
    
    2 16
     
    
    3 17
     	* CMakeLists.txt: Update location of `LICENSE.TXT`.
    

  • src/sfnt/sfwoff2.c
    ... ... @@ -2208,6 +2208,25 @@
    2208 2208
                   sizeof ( WOFF2_Table ),
    
    2209 2209
                   compare_tags );
    
    2210 2210
     
    
    2211
    +    /* reject fonts that have multiple tables with the same tag */
    
    2212
    +    for ( nn = 1; nn < woff2.num_tables; nn++ )
    
    2213
    +    {
    
    2214
    +      FT_ULong  tag = indices[nn]->Tag;
    
    2215
    +
    
    2216
    +
    
    2217
    +      if ( tag == indices[nn - 1]->Tag )
    
    2218
    +      {
    
    2219
    +        FT_ERROR(( "woff2_open_font:"
    
    2220
    +                   " multiple tables with tag `%c%c%c%c'.\n",
    
    2221
    +                   (FT_Char)( tag >> 24 ),
    
    2222
    +                   (FT_Char)( tag >> 16 ),
    
    2223
    +                   (FT_Char)( tag >> 8  ),
    
    2224
    +                   (FT_Char)( tag       ) ));
    
    2225
    +        error = FT_THROW( Invalid_Table );
    
    2226
    +        goto Exit;
    
    2227
    +      }
    
    2228
    +    }
    
    2229
    +
    
    2211 2230
         if ( woff2.uncompressed_size < 1 )
    
    2212 2231
         {
    
    2213 2232
           error = FT_THROW( Invalid_Table );
    


  • reply via email to

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