[Fontconfig] [Fwd: Bug in ftbdf.c?]

Joe Marcus Clarke fontconfig@fontconfig.org
17 Apr 2003 15:11:06 -0400


--=-vnGdStyUuXr/EqQLSsiS
Content-Type: multipart/mixed; boundary="=-yiJ1NuiR8b6t9rFfHE/k"


--=-yiJ1NuiR8b6t9rFfHE/k
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

Sorry, I meant to send this out to the fontconfig people as well.

Joe
=09
--=20
Joe Marcus Clarke
FreeBSD GNOME Team	::	marcus@FreeBSD.org
http://www.FreeBSD.org/gnome



--=-yiJ1NuiR8b6t9rFfHE/k
Content-Disposition: inline
Content-Description: Forwarded message - Bug in ftbdf.c?
Content-Type: message/rfc822

Subject: Bug in ftbdf.c?
From: Joe Marcus Clarke <marcus@FreeBSD.org>
To: devel@freetype.org
Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-3pDB0HQfjoHcqJ+bIP6e"
Organization: FreeBSD, Inc.
Message-Id: <1050606598.360.33.camel@gyros>
Mime-Version: 1.0
X-Mailer: Ximian Evolution 1.2.4
Date: 17 Apr 2003 15:09:58 -0400


--=-3pDB0HQfjoHcqJ+bIP6e
Content-Type: multipart/mixed; boundary="=-f4rh8c9zBO6f4XSPEN43"


--=-f4rh8c9zBO6f4XSPEN43
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

After Keith Packard's latest diffs to fontconfig, I think I found a bug
in ftbdf.c.  When a font face created from a font such as the Windows
VGAFIX.FON is passed to FT_Get_BDF_Property(),=20
driver->root.clazz->get_interface is called unchecked.  It so happens
that with fonts such as this, get_interface is 0.  The attached patch to
ftbdf.c corrects the problem, but I'm not sure if this is the correct
place for the patch.  Perhaps there is something fontconfig is doing
wrong, but I can't see what it is.  Here is a stack trace of the
problem:

#0  0x0 in ?? ()
#1  0x2809a771 in FT_Get_BDF_Property (face=3D0x804f100,
    prop_name=3D0x2808179e "FOUNDRY", aproperty=3D0xbfbff650)
    at
/usr/ports/print/freetype2/work/freetype-2.1.4/src/base/ftbdf.c:90
#2  0x2807724d in FcFreeTypeQuery (
    file=3D0x8050000 "/usr/X11R6/lib/X11/fonts/xxx/VGAFIX.FON", id=3D0,
    blanks=3D0x8058680, count=3D0xbfbff6dc) at fcfreetype.c:784
#3  0x2807626a in FcFileScan (set=3D0x804d0a0, dirs=3D0x804d0e0, cache=3D0x=
0,
    blanks=3D0x8058680,
    file=3D0x8050000 "/usr/X11R6/lib/X11/fonts/xxx/VGAFIX.FON", force=3D1)
    at fcdir.c:113
#4  0x280764eb in FcDirScan (set=3D0x804d0a0, dirs=3D0x804d0e0, cache=3D0x0=
,
    blanks=3D0x8058680, dir=3D0x804b020 "/usr/X11R6/lib/X11/fonts/xxx",
force=3D1)
    at fcdir.c:221
#5  0x8048d55 in scanDirs (list=3D0x804d090, config=3D0x804c000,
    program=3D0xbfbff9b4 "fc-cache", force=3D1, verbose=3D1) at fc-cache.c:=
166
#6  0x8049008 in main (argc=3D4, argv=3D0xbfbff880) at fc-cache.c:278
#7  0x8048a22 in _start ()
(gdb) frame 1
(gdb) print *driver->root.clazz
$1 =3D {module_flags =3D 1, module_size =3D 40, module_name =3D 0x280d8196
"winfonts",
  module_version =3D 65536, module_requires =3D 131072, module_interface =
=3D
0x0,
  module_init =3D 0, module_done =3D 0, get_interface =3D 0}

Joe

--=20
Joe Marcus Clarke
FreeBSD GNOME Team	::	marcus@FreeBSD.org
http://www.FreeBSD.org/gnome



--=-f4rh8c9zBO6f4XSPEN43
Content-Disposition: attachment; filename=patch-src_base_ftbdf.c
Content-Transfer-Encoding: quoted-printable
Content-Type: text/x-c; name=patch-src_base_ftbdf.c; charset=ISO8859-1

--- src/base/ftbdf.c.orig	Thu Apr 17 15:06:41 2003
+++ src/base/ftbdf.c	Thu Apr 17 15:07:16 2003
@@ -85,10 +85,13 @@
       FT_Driver              driver =3D face->driver;
       BDF_GetPropertyFunc    func;
=20
-      func =3D (BDF_GetPropertyFunc) driver->root.clazz->get_interface(
-                             FT_MODULE( driver ), "get_bdf_property" );
-      if ( func )
-        error =3D func( face, prop_name, aproperty );
+      if (driver->root.clazz->get_interface)
+      {
+        func =3D (BDF_GetPropertyFunc) driver->root.clazz->get_interface(
+                               FT_MODULE( driver ), "get_bdf_property" );
+        if ( func )
+          error =3D func( face, prop_name, aproperty );
+      }
     }
     return error;
   }

--=-f4rh8c9zBO6f4XSPEN43--

--=-3pDB0HQfjoHcqJ+bIP6e
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (FreeBSD)

iD8DBQA+nvwGb2iPiv4Uz4cRAqe7AKCWp94bT3j+mnhGv/5cdRkeFQZ/NACgndst
lOqRT//gRMuGrFeRcVYDbnw=
=uqRK
-----END PGP SIGNATURE-----

--=-3pDB0HQfjoHcqJ+bIP6e--

--=-yiJ1NuiR8b6t9rFfHE/k--

--=-vnGdStyUuXr/EqQLSsiS
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (FreeBSD)

iD8DBQA+nvxJb2iPiv4Uz4cRAopsAJ9yf8yJ/CL7W0q/BV1f8VC+9coSRACffRbB
nCcvovI3bV6iOk3unl+3RZg=
=Vb0O
-----END PGP SIGNATURE-----

--=-vnGdStyUuXr/EqQLSsiS--