summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/freetype/src/sfnt/pngshim.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/freetype/src/sfnt/pngshim.c')
-rw-r--r--src/3rdparty/freetype/src/sfnt/pngshim.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/3rdparty/freetype/src/sfnt/pngshim.c b/src/3rdparty/freetype/src/sfnt/pngshim.c
index 1bd3a7eeb5..33712162e0 100644
--- a/src/3rdparty/freetype/src/sfnt/pngshim.c
+++ b/src/3rdparty/freetype/src/sfnt/pngshim.c
@@ -4,7 +4,7 @@
*
* PNG Bitmap glyph support.
*
- * Copyright (C) 2013-2020 by
+ * Copyright (C) 2013-2023 by
* Google, Inc.
* Written by Stuart Gill and Behdad Esfahbod.
*
@@ -72,7 +72,6 @@
( ( __clang_major__ >= 4 ) || \
( ( __clang_major__ == 3 ) && ( __clang_minor__ >= 2 ) ) ) ) ) && \
defined( __OPTIMIZE__ ) && \
- !defined( __EMSCRIPTEN__ ) && \
defined( __SSE__ ) && \
__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
@@ -240,7 +239,7 @@
*e = FT_THROW( Invalid_Stream_Read );
png_error( png, NULL );
- return;
+ /* return; (never reached) */
}
ft_memcpy( data, stream->cursor, length );
@@ -271,7 +270,10 @@
int bitdepth, color_type, interlace;
FT_Int i;
- png_byte* *rows = NULL; /* pacify compiler */
+
+ /* `rows` gets modified within a 'setjmp' scope; */
+ /* we thus need the `volatile` keyword. */
+ png_byte* *volatile rows = NULL;
if ( x_offset < 0 ||
@@ -365,7 +367,7 @@
}
/* transform transparency to alpha */
- if ( png_get_valid(png, info, PNG_INFO_tRNS ) )
+ if ( png_get_valid( png, info, PNG_INFO_tRNS ) )
png_set_tRNS_to_alpha( png );
if ( bitdepth == 16 )
@@ -385,7 +387,7 @@
png_set_filler( png, 0xFF, PNG_FILLER_AFTER );
/* recheck header after setting EXPAND options */
- png_read_update_info(png, info );
+ png_read_update_info( png, info );
png_get_IHDR( png, info,
&imgWidth, &imgHeight,
&bitdepth, &color_type, &interlace,
@@ -404,9 +406,7 @@
switch ( color_type )
{
- default:
- /* Shouldn't happen, but fall through. */
-
+ default: /* Shouldn't happen, but ... */
case PNG_COLOR_TYPE_RGB_ALPHA:
png_set_read_user_transform_fn( png, premultiply_data );
break;
@@ -428,7 +428,7 @@
goto DestroyExit;
}
- if ( FT_NEW_ARRAY( rows, imgHeight ) )
+ if ( FT_QNEW_ARRAY( rows, imgHeight ) )
{
error = FT_THROW( Out_Of_Memory );
goto DestroyExit;
@@ -439,11 +439,11 @@
png_read_image( png, rows );
- FT_FREE( rows );
-
png_read_end( png, info );
DestroyExit:
+ /* even if reading fails with longjmp, rows must be freed */
+ FT_FREE( rows );
png_destroy_read_struct( &png, &info, NULL );
FT_Stream_Close( &stream );
@@ -454,7 +454,7 @@
#else /* !(TT_CONFIG_OPTION_EMBEDDED_BITMAPS && FT_CONFIG_OPTION_USE_PNG) */
/* ANSI C doesn't like empty source files */
- typedef int _pngshim_dummy;
+ typedef int pngshim_dummy_;
#endif /* !(TT_CONFIG_OPTION_EMBEDDED_BITMAPS && FT_CONFIG_OPTION_USE_PNG) */