[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.
This commit is contained in:
Werner Lemberg 2011-11-27 16:39:53 +01:00
parent 6e0d4cdf0e
commit ed54e43aed
3 changed files with 27 additions and 7 deletions

View File

@ -1,3 +1,20 @@
2011-11-27 Werner Lemberg <wl@gnu.org>
[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 <wl@gnu.org>
[bdf] Improve tracing.
@ -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

View File

@ -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 @@ FT_BEGIN_HEADER
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. */

View File

@ -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 )
{