freetype-commit
[Top][All Lists]
Advanced

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

[Git][freetype/freetype][master] [truetype] Tweak `hdmx` checking.


From: Alexei Podtelezhnikov (@apodtele)
Subject: [Git][freetype/freetype][master] [truetype] Tweak `hdmx` checking.
Date: Fri, 10 Sep 2021 14:22:15 +0000

Alexei Podtelezhnikov pushed to branch master at FreeType / FreeType

Commits:

1 changed file:

Changes:

  • src/truetype/ttpload.c
    ... ... @@ -548,8 +548,8 @@
    548 548
         record_size = FT_NEXT_ULONG( p );
    
    549 549
     
    
    550 550
         /* The maximum number of bytes in an hdmx device record is the */
    
    551
    -    /* maximum number of glyphs + 2; this is 0xFFFF + 2, thus      */
    
    552
    -    /* explaining why `record_size' is a long (which we read as    */
    
    551
    +    /* maximum number of glyphs + 2 + 32-bit padding, or 0x10004,  */
    
    552
    +    /* that is why `record_size' is a long (which we read as       */
    
    553 553
         /* unsigned long for convenience).  In practice, two bytes are */
    
    554 554
         /* sufficient to hold the size value.                          */
    
    555 555
         /*                                                             */
    
    ... ... @@ -562,10 +562,10 @@
    562 562
           record_size &= 0xFFFFU;
    
    563 563
     
    
    564 564
         /* The limit for `num_records' is a heuristic value. */
    
    565
    -    if ( num_records > 255              ||
    
    566
    -         ( num_records > 0            &&
    
    567
    -           ( record_size > 0x10001L ||
    
    568
    -             record_size < 4        ) ) )
    
    565
    +    if ( num_records > 255               ||
    
    566
    +         ( num_records > 0             &&
    
    567
    +           ( record_size > 0x10004UL ||
    
    568
    +             record_size & 3         ) ) )
    
    569 569
         {
    
    570 570
           error = FT_THROW( Invalid_File_Format );
    
    571 571
           goto Fail;
    


  • reply via email to

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