freetype-commit
[Top][All Lists]
Advanced

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

[Git][freetype/freetype][master] * src/cid/cidload.c (cid_hex_to_binary)


From: Werner Lemberg (@wl)
Subject: [Git][freetype/freetype][master] * src/cid/cidload.c (cid_hex_to_binary): Improve return value.
Date: Tue, 04 May 2021 06:57:16 +0000

Werner Lemberg pushed to branch master at FreeType / FreeType

Commits:

2 changed files:

Changes:

  • ChangeLog
    1
    +2021-05-04  Ben Wagner  <bungeman@chromium.org>
    
    2
    +
    
    3
    +	* src/cid/cidload.c (cid_hex_to_binary): Improve return value.
    
    4
    +
    
    5
    +	Add argument to return the actual number of bytes that were decoded.
    
    6
    +	The actual number of bytes decoded can be quite variable depending
    
    7
    +	on the number of ignored 'whitespace' bytes or early termination
    
    8
    +	with `>`.
    
    9
    +	(cid_face_open): Updated to use this calculated value.  This avoids
    
    10
    +	trusting `parser->binary_length` is always be correct and reading
    
    11
    +	uninitialized bits if fewer are actually decoded.
    
    12
    +
    
    13
    +	First reported as
    
    14
    +
    
    15
    +	  https://crbug.com/1203240
    
    16
    +
    
    1 17
     2021-05-03  Alexei Podtelezhnikov  <apodtele@gmail.com>
    
    2 18
     
    
    3 19
     	[sfnt] Streamline POST format 2.0 handing.
    
    ... ... @@ -43,7 +59,7 @@
    43 59
     	[truetype] Avoid some memory zeroing.
    
    44 60
     
    
    45 61
     	* src/truetype/ttinterp.c (Init_Context): Tweak allocation macro.
    
    46
    -	* src/truetype/ttpload.c (tt_face_load_cvt): Ditto. 
    
    62
    +	* src/truetype/ttpload.c (tt_face_load_cvt): Ditto.
    
    47 63
     
    
    48 64
     2021-05-01  Alexei Podtelezhnikov  <apodtele@gmail.com>
    
    49 65
     
    

  • src/cid/cidload.c
    ... ... @@ -668,14 +668,15 @@
    668 668
       cid_hex_to_binary( FT_Byte*  data,
    
    669 669
                          FT_ULong  data_len,
    
    670 670
                          FT_ULong  offset,
    
    671
    -                     CID_Face  face )
    
    671
    +                     CID_Face  face,
    
    672
    +                     FT_ULong* data_written )
    
    672 673
       {
    
    673 674
         FT_Stream  stream = face->root.stream;
    
    674 675
         FT_Error   error;
    
    675 676
     
    
    676 677
         FT_Byte    buffer[256];
    
    677 678
         FT_Byte   *p, *plimit;
    
    678
    -    FT_Byte   *d, *dlimit;
    
    679
    +    FT_Byte   *d = data, *dlimit;
    
    679 680
         FT_Byte    val;
    
    680 681
     
    
    681 682
         FT_Bool    upper_nibble, done;
    
    ... ... @@ -684,7 +685,6 @@
    684 685
         if ( FT_STREAM_SEEK( offset ) )
    
    685 686
           goto Exit;
    
    686 687
     
    
    687
    -    d      = data;
    
    688 688
         dlimit = d + data_len;
    
    689 689
         p      = buffer;
    
    690 690
         plimit = p;
    
    ... ... @@ -758,6 +758,7 @@
    758 758
         error = FT_Err_Ok;
    
    759 759
     
    
    760 760
       Exit:
    
    761
    +    *data_written = d - data;
    
    761 762
         return error;
    
    762 763
       }
    
    763 764
     
    
    ... ... @@ -816,11 +817,12 @@
    816 817
                FT_SET_ERROR( cid_hex_to_binary( face->binary_data,
    
    817 818
                                                 parser->binary_length,
    
    818 819
                                                 parser->data_offset,
    
    819
    -                                            face ) )               )
    
    820
    +                                            face,
    
    821
    +                                            &binary_length ) )     )
    
    820 822
             goto Exit;
    
    821 823
     
    
    822 824
           FT_Stream_OpenMemory( face->cid_stream,
    
    823
    -                            face->binary_data, parser->binary_length );
    
    825
    +                            face->binary_data, binary_length );
    
    824 826
           cid->data_offset = 0;
    
    825 827
         }
    
    826 828
         else
    


  • reply via email to

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