freetype-commit
[Top][All Lists]
Advanced

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

[Git][freetype/freetype][master] [sfnt] Fix memory leak in png loading.


From: Werner Lemberg
Subject: [Git][freetype/freetype][master] [sfnt] Fix memory leak in png loading.
Date: Tue, 16 Mar 2021 07:48:11 +0000

Werner Lemberg pushed to branch master at FreeType / FreeType

Commits:

2 changed files:

Changes:

  • ChangeLog
    1
    +2021-03-16  Ben Wagner  <bungeman@google.com>
    
    2
    +
    
    3
    +	[sfnt] Fix memory leak in png loading.
    
    4
    +
    
    5
    +	Reported as
    
    6
    +
    
    7
    +	  https://bugs.chromium.org/p/chromium/issues/detail?id=1182552
    
    8
    +
    
    9
    +	Memory is allocated and the pointer assigned to `rows` inside a
    
    10
    +	'setjmp' scope.  This memory must be freed outside the 'setjmp'
    
    11
    +	scope after a 'longjmp'.  Since `rows` is a local and modified
    
    12
    +	inside the 'setjmp' scope it must be marked volatile or it will have
    
    13
    +	an indeterminate value after the 'longjmp'.
    
    14
    +
    
    15
    +	* src/sfnt/pngshim.c (Load_SBit_Png): Fix memory leak of `rows`.
    
    16
    +
    
    1 17
     2021-03-16  Christopher Degawa  <ccom@randomderp.com>
    
    2 18
     
    
    3 19
     	* CMakeLists.txt: Don't limit generation of 'pkg-config' file to UNIX.
    

  • src/sfnt/pngshim.c
    ... ... @@ -270,7 +270,10 @@
    270 270
     
    
    271 271
         int         bitdepth, color_type, interlace;
    
    272 272
         FT_Int      i;
    
    273
    -    png_byte*  *rows = NULL; /* pacify compiler */
    
    273
    +
    
    274
    +    /* `rows` gets modified within a 'setjmp' scope; */
    
    275
    +    /* we thus need the `volatile` keyword.          */
    
    276
    +    png_byte* *volatile  rows = NULL;
    
    274 277
     
    
    275 278
     
    
    276 279
         if ( x_offset < 0 ||
    


  • reply via email to

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