ref: ed54e43aed19f6078a254a6293e7686c489bff8d
parent: 6e0d4cdf0e25d6ac328a51cbd3fa28a14ab05491
author: Werner Lemberg <[email protected]>
date: Sun Nov 27 11:39:53 EST 2011
[bdf] Fix Savannah bug #34896. ENCODING now covers the whole Unicode range. Note, however, that this change is quite expensive since it increases the size of three arrays by almost 400kByte in total. The right fix is to replace the logic with something smarter. Additionally, there exist very old BDFs for three-byte CCCII encoding which exceeds the range of Unicode (another reason to have a smarter logic). * src/bdf/bdf.h (bdf_font_t): Increase size of `nmod' and `umod' arrays. * src/bdf/bdflib.c (bdf_parse_t): Increase size of `have' array.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,22 @@
2011-11-27 Werner Lemberg <[email protected]>
+ [bdf] Fix Savannah bug #34896.
+
+ ENCODING now covers the whole Unicode range.
+
+ Note, however, that this change is quite expensive since it
+ increases the size of three arrays by almost 400kByte in total. The
+ right fix is to replace the logic with something smarter.
+ Additionally, there exist very old BDFs for three-byte CCCII
+ encoding which exceeds the range of Unicode (another reason to have
+ a smarter logic).
+
+ * src/bdf/bdf.h (bdf_font_t): Increase size of `nmod' and `umod'
+ arrays.
+ * src/bdf/bdflib.c (bdf_parse_t): Increase size of `have' array.
+
+2011-11-27 Werner Lemberg <[email protected]>
+
[bdf] Improve tracing.
* src/bdf/bdflib.c (DBGMSG1, DBGMSG2): New macros.
@@ -303,7 +320,7 @@
Add explicit LZW decompression stack size limit.
Stack larger than 1<<LZW_MAX_BITS is never needed if prefix table is
- constructed correctly. It's even less than that, see e.g.
+ constructed correctly. It's even less than that, see e.g.
libarchive code comment for a better size upper bound:
http://code.google.com/p/libarchive/source/browse/trunk/libarchive/archive_read_support_filter_compress.c?r=3635#121
--- a/src/bdf/bdf.h
+++ b/src/bdf/bdf.h
@@ -1,6 +1,6 @@
/*
* Copyright 2000 Computing Research Labs, New Mexico State University
- * Copyright 2001, 2002, 2003, 2004 Francesco Zappa Nardelli
+ * Copyright 2001-2004, 2011 Francesco Zappa Nardelli
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -226,8 +226,10 @@
void* internal; /* Internal data for the font. */
- unsigned long nmod[2048]; /* Bitmap indicating modified glyphs. */
- unsigned long umod[2048]; /* Bitmap indicating modified */
+ /* The size of the next two arrays must be in sync with the */
+ /* size of the `have' array in the `bdf_parse_t' structure. */
+ unsigned long nmod[34816]; /* Bitmap indicating modified glyphs. */
+ unsigned long umod[34816]; /* Bitmap indicating modified */
/* unencoded glyphs. */
unsigned short modified; /* Boolean indicating font modified. */
unsigned short bpp; /* Bits per pixel. */
--- a/src/bdf/bdflib.c
+++ b/src/bdf/bdflib.c
@@ -413,7 +413,8 @@
bdf_font_t* font;
bdf_options_t* opts;
- unsigned long have[2048];
+ unsigned long have[34816]; /* must be in sync with `nmod' and `umod' */
+ /* arrays from `bdf_font_t' structure */
_bdf_list_t list;
FT_Memory memory;
@@ -1605,8 +1606,8 @@
FT_TRACE4(( DBGMSG2, p->glyph_enc ));
- /* Check that the encoding is in the range [0,65536] because */
- /* otherwise p->have (a bitmap with static size) overflows. */
+ /* Check that the encoding is in the Unicode range because */
+ /* otherwise p->have (a bitmap with static size) overflows. */
if ( p->glyph_enc > 0 &&
(size_t)p->glyph_enc >= sizeof ( p->have ) * 8 )
{