Fix Savannah bug #33663. * src/bdf/bdflib.c (_bdf_parse_glyphs): Handle negative values for ENCODING correctly.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
diff --git a/ChangeLog b/ChangeLog
index ef582eb..7dc46c6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2011-06-29 Werner Lemberg <wl@gnu.org>
+
+ Fix Savannah bug #33663.
+
+ * src/bdf/bdflib.c (_bdf_parse_glyphs): Handle negative values for
+ ENCODING correctly.
+
2011-06-24 Werner Lemberg <wl@gnu.org>
* Version 2.4.5 released.
diff --git a/src/bdf/bdflib.c b/src/bdf/bdflib.c
index 21b8d9d..61bae36 100644
--- a/src/bdf/bdflib.c
+++ b/src/bdf/bdflib.c
@@ -1,6 +1,6 @@
/*
* Copyright 2000 Computing Research Labs, New Mexico State University
- * Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010
+ * Copyright 2001-2011
* Francesco Zappa Nardelli
*
* Permission is hereby granted, free of charge, to any person obtaining a
@@ -983,7 +983,7 @@
FT_Error error = BDF_Err_Ok;
- /* First check to see if the property has */
+ /* First check whether the property has */
/* already been added or not. If it has, then */
/* simply ignore it. */
if ( hash_lookup( name, &(font->proptbl) ) )
@@ -1276,7 +1276,7 @@
FT_Error error = BDF_Err_Ok;
- /* First, check to see if the property already exists in the font. */
+ /* First, check whether the property already exists in the font. */
if ( ( hn = hash_lookup( name, (hashtable *)font->internal ) ) != 0 )
{
/* The property already exists in the font, so simply replace */
@@ -1530,8 +1530,8 @@
goto Exit;
}
- /* Check to see whether a glyph is being scanned but should be */
- /* ignored because it is an unencoded glyph. */
+ /* Check whether a glyph is being scanned but should be */
+ /* ignored because it is an unencoded glyph. */
if ( ( p->flags & _BDF_GLYPH ) &&
p->glyph_enc == -1 &&
p->opts->keep_unencoded == 0 )
@@ -1585,17 +1585,18 @@
p->glyph_enc = _bdf_atol( p->list.field[1], 0, 10 );
- /* Check that the encoding is in the range [0,65536] because */
- /* otherwise p->have (a bitmap with static size) overflows. */
- if ( (size_t)p->glyph_enc >= sizeof ( p->have ) * 8 )
+ /* Check that the encoding is in the range [0,65536] because */
+ /* otherwise p->have (a bitmap with static size) overflows. */
+ if ( p->glyph_enc > 0 &&
+ (size_t)p->glyph_enc >= sizeof ( p->have ) * 8 )
{
error = BDF_Err_Invalid_File_Format;
goto Exit;
}
- /* Check to see whether this encoding has already been encountered. */
- /* If it has then change it to unencoded so it gets added if */
- /* indicated. */
+ /* Check whether this encoding has already been encountered. */
+ /* If it has then change it to unencoded so it gets added if */
+ /* indicated. */
if ( p->glyph_enc >= 0 )
{
if ( _bdf_glyph_modified( p->have, p->glyph_enc ) )
@@ -1634,8 +1635,8 @@
}
else
{
- /* Unencoded glyph. Check to see whether it should */
- /* be added or not. */
+ /* Unencoded glyph. Check whether it should */
+ /* be added or not. */
if ( p->opts->keep_unencoded != 0 )
{
/* Allocate the next unencoded glyph. */
@@ -1676,7 +1677,7 @@
else
glyph = font->glyphs + ( font->glyphs_used - 1 );
- /* Check to see whether a bitmap is being constructed. */
+ /* Check whether a bitmap is being constructed. */
if ( p->flags & _BDF_BITMAP )
{
/* If there are more rows than are specified in the glyph metrics, */