Commit 28dd2c45957278e962f95633157b6139de8170aa

Werner Lemberg 2012-02-26T06:18:58

[bdf] Fix Savannah bug #35607. * src/bdf/bdflib.c (_bdf_parse_glyphs) <ENCODING>: Normalize negative encoding values.

diff --git a/ChangeLog b/ChangeLog
index 044c3b0..a99df1d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2012-02-26  Werner Lemberg  <wl@gnu.org>
 
+	[bdf] Fix Savannah bug #35607.
+
+	* src/bdf/bdflib.c (_bdf_parse_glyphs) <ENCODING>: Normalize
+	negative encoding values.
+
+2012-02-26  Werner Lemberg  <wl@gnu.org>
+
 	[type1] Fix Savannah bug #35606.
 
 	* src/type1/t1load.c (parse_subrs): Add proper guards for `strncmp'.
diff --git a/src/bdf/bdflib.c b/src/bdf/bdflib.c
index f2ca92d..4242cab 100644
--- a/src/bdf/bdflib.c
+++ b/src/bdf/bdflib.c
@@ -1606,6 +1606,11 @@
 
       p->glyph_enc = _bdf_atol( p->list.field[1], 0, 10 );
 
+      /* Normalize negative encoding values.  The specification only */
+      /* allows -1, but we can be more generous here.                */
+      if ( p->glyph_enc < -1 )
+        p->glyph_enc = -1;
+
       FT_TRACE4(( DBGMSG2, p->glyph_enc ));
 
       /* Check that the encoding is in the Unicode range because  */