freetype-commit
[Top][All Lists]
Advanced

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

[Git][freetype/freetype-demos][master] Correct type of icon_span


From: Ben Wagner (@bungeman)
Subject: [Git][freetype/freetype-demos][master] Correct type of icon_span
Date: Fri, 12 May 2023 15:49:12 +0000

Ben Wagner pushed to branch master at FreeType / FreeType Demo Programs

Commits:

  • 37342861
    by Ben Wagner at 2023-05-12T15:48:28+00:00
    Correct type of icon_span
    
    The `icon_span` is used as a `FT_SpanFunc`. To avoid undefined behavior
    and a CFI sanitizer report, this function needs to called through a
    pointer of the same type. Fix this by making `icon_span` take the right
    parameter types and cast the argument in the function body.
    
    * src/ftcommon.c (icon_span): take correct parameters and cast in
    function body. (FTDemo_Icon): remove cast
    

1 changed file:

Changes:

  • src/ftcommon.c
    ... ... @@ -467,8 +467,9 @@
    467 467
       icon_span( int              y,
    
    468 468
                  int              count,
    
    469 469
                  const FT_Span*   spans,
    
    470
    -             grBitmap*        icon )
    
    470
    +             void*            user )
    
    471 471
       {
    
    472
    +    grBitmap*       icon = (grBitmap*)user;
    
    472 473
         FT_UInt32*      dst_line;
    
    473 474
         FT_UInt32*      dst;
    
    474 475
         FT_UInt32       color = 0xFF7F00;
    
    ... ... @@ -508,7 +509,7 @@
    508 509
     
    
    509 510
         FT_Raster_Params  params = { NULL, NULL,
    
    510 511
                                      FT_RASTER_FLAG_AA | FT_RASTER_FLAG_DIRECT,
    
    511
    -                                 (FT_SpanFunc)icon_span, NULL, NULL, NULL,
    
    512
    +                                 icon_span, NULL, NULL, NULL,
    
    512 513
                                      &icon, { 0, 0, 0, 0 } };
    
    513 514
     
    
    514 515
     
    


  • reply via email to

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