[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] BUG, PATCH: Don't barf on invalid Unix font files
- To: pygame-users@xxxxxxxx
- Subject: Re: [pygame] BUG, PATCH: Don't barf on invalid Unix font files
- From: Rene Dudfield <renesd@xxxxxxxxx>
- Date: Tue, 22 Nov 2005 13:34:37 +1100
- Delivered-to: archiver@seul.org
- Delivered-to: pygame-users-outgoing@seul.org
- Delivered-to: pygame-users@seul.org
- Delivery-date: Mon, 21 Nov 2005 21:34:42 -0500
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=a8heHl83r586rhh0rt7AYwKPevlwBifXfhoERDQ4KPEKvxT+b8d0US6KszKHXQgh0UczKl8nnHcit1EaX7cfhoH+S4+GZ0CcdumiOS7FSuiQrS/EtMMJKu8nn/I/HuHOLg9BYG8M7FtJ0cnstneMIi7HQ7UnCH7GY1/HbWeigAE=
- In-reply-to: <1132622626.13723.5.camel@localhost>
- References: <1132622626.13723.5.camel@localhost>
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
Thanks.
It's been applied to cvs.
On 11/22/05, Joe Wreschnig <piman@xxxxxxxxxxxxxx> wrote:
> A small patch to prevent a ValueError when getting a list of fonts on
> Unix; this fixes Debian bug #337120.
>
> --- pygame-1.7.1release.orig/lib/sysfont.py
> +++ pygame-1.7.1release/lib/sysfont.py
> @@ -149,7 +149,9 @@
> #read the fonts from a unix 'fonts.dot' file
> def read_unix_fontsdir(dir, file, fonts):
> file = open(os.path.join(dir, file))
> - numfonts = int(file.readline())
> + try: numfonts = int(file.readline())
> + except ValueError: return # probably not a font file
> +
> for line in file.readlines():
> font, descr = (line.split(' ', 1) + ['', ''])[:2]
> if font[-4:].lower() not in [".ttf", ".ttc"]:
> --
> Joe Wreschnig <piman@xxxxxxxxxxxxxx>
>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.1 (GNU/Linux)
>
> iD8DBQBDgnMiTFkUq7Drx3cRAmsgAJ4kR6SdQ7uWewfcZJPMQjptiRm5cwCgw7f6
> ikUEp6uFv0nVTXBmvKBZkTg=
> =NOGk
> -----END PGP SIGNATURE-----
>
>
>