freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ft-devel] missing out-of-memory check when creating family name for Tru


From: Graham Asher
Subject: [ft-devel] missing out-of-memory check when creating family name for TrueType fonts
Date: Wed, 5 Nov 2008 10:01:15 -0000

Here's another problem caused by a missing out-of-memory check. The function


tt_face_get_name

in sfobjs.c is defined as returning NULL if no name is present, but also
returns NULL if the name is in fact present but there is no memory to
allocate a copy of the name. This ambiguity leads to FT_Open_Face and
associated functions seeming to succeed when in fact the face has not been
constructed correctly.

The correct fix would be for tt_face_get_name and similar functions to
return an error code as well as the face pointer. For the moment I have no
time to work out the correct set of patches, but I'll just put this on
record as a warning.

Callers should check whether face->family_name is null before using it; a
missing family name is likely to be an error although the API doesn't
actually tell us whether it is. 

Graham Asher






reply via email to

[Prev in Thread] Current Thread [Next in Thread]