ref: 705bac50d3ade49188e05018ede2072e4d1e1788
parent: 7ec9598f47e5e8f6e05c38508d1e59e2bb9395ee
author: Alexei Podtelezhnikov <[email protected]>
date: Tue Aug 7 18:49:55 EDT 2018
* src/pcf/pcfread.c (pcf_get_bitmaps): Unsign `offsets' and `bitmapSizes'.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2018-08-06 Alexei Podtelezhnikov <[email protected]>
+
+ * src/pcf/pcfread.c (pcf_get_bitmaps): Unsign `offsets' and
+ `bitmapSizes'.
+
2018-08-06 Werner Lemberg <[email protected]>
* devel/ftoption.h: Synchronize with main `ftoption.h'.
--- a/src/pcf/pcfread.c
+++ b/src/pcf/pcfread.c
@@ -810,8 +810,8 @@
{
FT_Error error;
FT_Memory memory = FT_FACE( face )->memory;
- FT_Long* offsets = NULL;
- FT_Long bitmapSizes[GLYPHPADOPTIONS];
+ FT_ULong* offsets = NULL;
+ FT_ULong bitmapSizes[GLYPHPADOPTIONS];
FT_ULong format, size;
FT_ULong nbitmaps, orig_nbitmaps, i, sizebitmaps = 0;
@@ -878,11 +878,11 @@
for ( i = 0; i < nbitmaps; i++ )
{
if ( PCF_BYTE_ORDER( format ) == MSBFirst )
- (void)FT_READ_LONG( offsets[i] );
+ (void)FT_READ_ULONG( offsets[i] );
else
- (void)FT_READ_LONG_LE( offsets[i] );
+ (void)FT_READ_ULONG_LE( offsets[i] );
- FT_TRACE5(( " bitmap %ld: offset %ld (0x%lX)\n",
+ FT_TRACE5(( " bitmap %lu: offset %lu (0x%lX)\n",
i, offsets[i], offsets[i] ));
}
if ( error )
@@ -891,22 +891,22 @@
for ( i = 0; i < GLYPHPADOPTIONS; i++ )
{
if ( PCF_BYTE_ORDER( format ) == MSBFirst )
- (void)FT_READ_LONG( bitmapSizes[i] );
+ (void)FT_READ_ULONG( bitmapSizes[i] );
else
- (void)FT_READ_LONG_LE( bitmapSizes[i] );
+ (void)FT_READ_ULONG_LE( bitmapSizes[i] );
if ( error )
goto Bail;
- sizebitmaps = (FT_ULong)bitmapSizes[PCF_GLYPH_PAD_INDEX( format )];
+ sizebitmaps = bitmapSizes[PCF_GLYPH_PAD_INDEX( format )];
- FT_TRACE4(( " %ld-bit padding implies a size of %ld\n",
+ FT_TRACE4(( " %ld-bit padding implies a size of %lu\n",
8 << i, bitmapSizes[i] ));
}
- FT_TRACE4(( " %ld bitmaps, using %ld-bit padding\n",
+ FT_TRACE4(( " %lu bitmaps, using %ld-bit padding\n",
nbitmaps,
8 << PCF_GLYPH_PAD_INDEX( format ) ));
- FT_TRACE4(( " bitmap size: %ld\n", sizebitmaps ));
+ FT_TRACE4(( " bitmap size: %lu\n", sizebitmaps ));
FT_UNUSED( sizebitmaps ); /* only used for debugging */
@@ -915,14 +915,13 @@
for ( i = 0; i < nbitmaps; i++ )
{
/* rough estimate */
- if ( ( offsets[i] < 0 ) ||
- ( (FT_ULong)offsets[i] > size ) )
+ if ( offsets[i] > size )
{
FT_TRACE0(( "pcf_get_bitmaps:"
- " invalid offset to bitmap data of glyph %ld\n", i ));
+ " invalid offset to bitmap data of glyph %lu\n", i ));
}
else
- face->metrics[i].bits = stream->pos + (FT_ULong)offsets[i];
+ face->metrics[i].bits = stream->pos + offsets[i];
}
face->bitmapsFormat = format;