summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2003-04-18 15:56:05 +0000
committerKeith Packard <keithp@keithp.com>2003-04-18 15:56:05 +0000
commit29d961a28e231302683577328ed4724319805a7f (patch)
treeb26cf07a710200dca8da885d2233f19aedee8bad
parent3a30abdb84ff973be86d4f75ee2fd54099f32ef1 (diff)
downloadfontconfig-29d961a28e231302683577328ed4724319805a7f.tar.gz
Guard calls to FT_Get_BDF_Property to avoid freetype jumping through null
pointer
-rw-r--r--src/fcfreetype.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/fcfreetype.c b/src/fcfreetype.c
index 5c766d1..70642b5 100644
--- a/src/fcfreetype.c
+++ b/src/fcfreetype.c
@@ -57,7 +57,13 @@
#if (FREETYPE_MINOR > 1 || (FREETYPE_MINOR == 1 && FREETYPE_PATCH >= 4))
#include <freetype/ftbdf.h>
+#include <freetype/ftmodule.h>
#define USE_FTBDF
+#define HAS_BDF_PROPERTY(f) ((f) && (f)->driver && \
+ (f)->driver->root.clazz->get_interface)
+#define MY_Get_BDF_Property(f,n,p) (HAS_BDF_PROPERTY(f) ? \
+ FT_Get_BDF_Property(f,n,p) : \
+ FT_Err_Invalid_Argument)
#endif
@@ -781,7 +787,7 @@ FcFreeTypeQuery (const FcChar8 *file,
{
int rc;
BDF_PropertyRec prop;
- rc = FT_Get_BDF_Property(face, "FOUNDRY", &prop);
+ rc = MY_Get_BDF_Property(face, "FOUNDRY", &prop);
if(rc == 0 && prop.type == BDF_PROPERTY_TYPE_ATOM)
foundry = prop.u.atom;
}
@@ -789,7 +795,7 @@ FcFreeTypeQuery (const FcChar8 *file,
if (width == -1)
{
BDF_PropertyRec prop;
- if (FT_Get_BDF_Property(face, "RELATIVE_SETWIDTH", &prop) == 0 &&
+ if (MY_Get_BDF_Property(face, "RELATIVE_SETWIDTH", &prop) == 0 &&
(prop.type == BDF_PROPERTY_TYPE_INTEGER ||
prop.type == BDF_PROPERTY_TYPE_CARDINAL))
{
@@ -811,7 +817,7 @@ FcFreeTypeQuery (const FcChar8 *file,
case 9: width = FC_WIDTH_ULTRAEXPANDED; break;
}
}
- else if (FT_Get_BDF_Property (face, "SETWIDTH_NAME", &prop) == 0 &&
+ else if (MY_Get_BDF_Property (face, "SETWIDTH_NAME", &prop) == 0 &&
prop.type == BDF_PROPERTY_TYPE_ATOM)
{
static struct {