freetype-commit
[Top][All Lists]
Advanced

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

[Git][freetype/freetype][master] [psaux] Full bounds check for OtherSubr


From: Werner Lemberg (@wl)
Subject: [Git][freetype/freetype][master] [psaux] Full bounds check for OtherSubr 19.
Date: Wed, 23 Feb 2022 16:49:53 +0000

Werner Lemberg pushed to branch master at FreeType / FreeType

Commits:

1 changed file:

Changes:

  • src/psaux/psintrp.c
    ... ... @@ -1900,7 +1900,8 @@
    1900 1900
                           /*     WeightVector                         */
    
    1901 1901
                           {
    
    1902 1902
                             FT_UInt   idx;
    
    1903
    -                        PS_Blend  blend = decoder->blend;
    
    1903
    +                        PS_Blend  blend         = decoder->blend;
    
    1904
    +                        FT_UInt   len_buildchar = decoder->len_buildchar;
    
    1904 1905
     
    
    1905 1906
     
    
    1906 1907
                             if ( arg_cnt != 1 || !blend )
    
    ... ... @@ -1908,14 +1909,15 @@
    1908 1909
     
    
    1909 1910
                             idx = (FT_UInt)cf2_stack_popInt( opStack );
    
    1910 1911
     
    
    1911
    -                        if ( idx + blend->num_designs >
    
    1912
    -                               decoder->len_buildchar   )
    
    1912
    +                        if ( len_buildchar < blend->num_designs       ||
    
    1913
    +                             len_buildchar - blend->num_designs < idx )
    
    1913 1914
                               goto Unexpected_OtherSubr;
    
    1914 1915
     
    
    1915
    -                        ft_memcpy( &decoder->buildchar[idx],
    
    1916
    -                                   blend->weight_vector,
    
    1917
    -                                   blend->num_designs *
    
    1918
    -                                   sizeof ( blend->weight_vector[0] ) );
    
    1916
    +                        if ( decoder->buildchar && blend->weight_vector )
    
    1917
    +                          ft_memcpy( &decoder->buildchar[idx],
    
    1918
    +                                     blend->weight_vector,
    
    1919
    +                                     blend->num_designs *
    
    1920
    +                                       sizeof ( blend->weight_vector[0] ) );
    
    1919 1921
                           }
    
    1920 1922
                           break;
    
    1921 1923
     
    


  • reply via email to

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