freetype-commit
[Top][All Lists]
Advanced

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

[Git][freetype/freetype][master] [sfnt] Check safety of cast to `TT_Driv


From: Werner Lemberg (@wl)
Subject: [Git][freetype/freetype][master] [sfnt] Check safety of cast to `TT_Driver` before accessing member.
Date: Thu, 07 Jul 2022 17:38:38 +0000

Werner Lemberg pushed to branch master at FreeType / FreeType

Commits:

  • 8a9192f6
    by Dominik Röttsches at 2022-07-07T19:36:49+02:00
    [sfnt] Check safety of cast to `TT_Driver` before accessing member.
    
    * src/sfnt/ttcolr.c (VARIABLE_COLRV1_ENABLED): Access
    `enable_variable_colrv1` only if driver class matches.
    

1 changed file:

Changes:

  • src/sfnt/ttcolr.c
    ... ... @@ -35,9 +35,11 @@
    35 35
     #include <freetype/ftcolor.h>
    
    36 36
     #include <freetype/config/integer-types.h>
    
    37 37
     
    
    38
    - /* the next code line is a temporary hack, to be removed together with */
    
    39
    - /* `VARIABLE_COLRV1_ENABLED` and related code                          */
    
    38
    + /* the next two code lines are a temporary hack, to be removed together */
    
    39
    + /* with `VARIABLE_COLRV1_ENABLED` and related code as soon as variable  */
    
    40
    + /* 'COLR' support is complete and tested                                */
    
    40 41
     #include "../truetype/ttobjs.h"
    
    42
    +#include "../truetype/ttdriver.h"
    
    41 43
     
    
    42 44
     
    
    43 45
     #ifdef TT_CONFIG_OPTION_COLOR_LAYERS
    
    ... ... @@ -55,8 +57,10 @@
    55 57
     #define COLR_HEADER_SIZE                 14U
    
    56 58
     
    
    57 59
     
    
    58
    -#define VARIABLE_COLRV1_ENABLED                                           \
    
    59
    -          ( ((TT_Driver)FT_FACE_DRIVER( face ))->enable_variable_colrv1 )
    
    60
    +#define VARIABLE_COLRV1_ENABLED                                            \
    
    61
    +          ( ((TT_Driver)FT_FACE_DRIVER( face ))->root.clazz ==             \
    
    62
    +              &tt_driver_class                                          && \
    
    63
    +            ((TT_Driver)FT_FACE_DRIVER( face ))->enable_variable_colrv1 )
    
    60 64
     
    
    61 65
     
    
    62 66
       typedef enum  FT_PaintFormat_Internal_
    


  • reply via email to

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