On 02/29/08 14:29, Klaus Schmidinger wrote:
> On 02/29/08 01:04, Tobi wrote:
>> DrawText() in font.c uses the method Glyph() which may return a null pointer,
>> but doesn't check the returned pointer.
>> I came across this bug, when checking a bug report from Sven Mueller:
>> When info.vdr contains an invalid character (like in the above example a
>> 0xA0 -
>> a Latin-1 NO-BREAK SPACE), Glyph() returns null, which then causes a
>> when dereferencing the null-pointer.
>> The easiest way to fix this, would probably be to ignore such invalid
>> characters, which is, what the attached two-line-patch will do. But maybe
>> better to replace such characters with a default character - maybe a space
>> or a '?'.
> I also think showing some replacement character is best.
> Can you please verify if the attached patch does this correctly?
> If this works, I'd like to include it in version 1.6.0.
Maybe the attached version is even better, because there are also other
places where Glyph() is called.
--- font.c 2008/02/09 11:52:25 1.23
+++ font.c 2008/02/29 13:35:15
@@ -214,6 +214,9 @@
+#define UNKNOWN_GLYPH_INDICATOR '?'
+ if (CharCode != UNKNOWN_GLYPH_INDICATOR)
+ return Glyph(UNKNOWN_GLYPH_INDICATOR);
@@ -258,6 +261,8 @@
uint sym = Utf8CharGet(s, sl);
s += sl;
cGlyph *g = Glyph(sym, AntiAliased);
+ if (!g)
int kerning = Kerning(g, prevSym);
prevSym = sym;
uchar *buffer = g->Bitmap();
vdr mailing list