From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Naohiro Aota Newsgroups: gmane.emacs.devel Subject: [PATCH] Fix paternize problem of fontset_pattern_regexp() Date: Sun, 15 Jun 2008 06:10:07 +0900 Message-ID: <878wx7yb80.fsf@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1213499533 5324 80.91.229.12 (15 Jun 2008 03:12:13 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 15 Jun 2008 03:12:13 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jun 15 05:12:57 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1K7ifl-0004es-EJ for ged-emacs-devel@m.gmane.org; Sun, 15 Jun 2008 05:12:53 +0200 Original-Received: from localhost ([127.0.0.1]:48800 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K7iex-0003lM-1c for ged-emacs-devel@m.gmane.org; Sat, 14 Jun 2008 23:12:03 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K7d0q-0002NI-Dk for emacs-devel@gnu.org; Sat, 14 Jun 2008 17:10:16 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K7d0p-0002LW-BD for emacs-devel@gnu.org; Sat, 14 Jun 2008 17:10:15 -0400 Original-Received: from [199.232.76.173] (port=55456 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K7d0p-0002LM-5a for emacs-devel@gnu.org; Sat, 14 Jun 2008 17:10:15 -0400 Original-Received: from ti-out-0910.google.com ([209.85.142.184]:53216) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1K7d0o-00075c-FW for emacs-devel@gnu.org; Sat, 14 Jun 2008 17:10:14 -0400 Original-Received: by ti-out-0910.google.com with SMTP id u5so1414625tia.10 for ; Sat, 14 Jun 2008 14:10:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:subject:date :message-id:user-agent:mime-version:content-type; bh=2qMxaFA6DAqZ1uY8+osYmBcc3fZiXre5jN1lcHuN64M=; b=oOyqPiJD/LEyvwiqN3oN8gA+taakpyo9Y44QReECUQZIu2sUZoelWiKe976EyUepsS amNkPDTsND+v/tVX5Ptc7bltFQG0ypY1kRxm7zwHTrsdfn6sD+3m5wDJgCBPaMLbGhK9 9Ud8Cgf9pGmFo62gFIacfm8joIrAd19jt85d8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:subject:date:message-id:user-agent:mime-version :content-type; b=lkbn4XmYuoQ9lzFy1C7PzisS3UaoZ1RmLT7dXGX8ptfcSECJhloMaMv+balegwZhgq S9imOOMsh2nBbnyZ0wwZbErWWA2LxoYZHR/r8cO9B3k9cKZ2BSrXg91SHgVqheFYNxs3 PoMxDuGWmU7Lut7XObe9NKtWY5KGOg8YlcoQc= Original-Received: by 10.110.84.3 with SMTP id h3mr2970475tib.43.1213477811737; Sat, 14 Jun 2008 14:10:11 -0700 (PDT) Original-Received: from yue ( [58.85.243.45]) by mx.google.com with ESMTPS id u12sm5865164tia.5.2008.06.14.14.10.09 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 14 Jun 2008 14:10:10 -0700 (PDT) User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.0.60 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) X-Mailman-Approved-At: Sat, 14 Jun 2008 23:11:59 -0400 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:99241 Archived-At: Hi, I found that fontset_pattern_regexp() doesn't escape '+'. Because of this bug, specifying a font whose name contains '+' [1] causes Emacs to die. This patch below would fix the problem. Regards, Naohiro Aota [1] For example, try evaluating `(set-default-font "M+ 1c")' [2]. [2] You can get this font from http://mplus-fonts.sourceforge.jp/mplus-outline-fonts/index.html (Japanese page) 2008-06-15 Naohiro Aota * fontset.c (fontset_pattern_regexp): Escape `+' characters in pattern. Index: src/fontset.c =================================================================== RCS file: /sources/emacs/emacs/src/fontset.c,v retrieving revision 1.132 diff -u -r1.132 fontset.c --- src/fontset.c 8 Jun 2008 09:01:28 -0000 1.132 +++ src/fontset.c 14 Jun 2008 19:54:58 -0000 @@ -1005,7 +1005,7 @@ { /* We must at first update the cached data. */ unsigned char *regex, *p0, *p1; - int ndashes = 0, nstars = 0; + int ndashes = 0, nstars = 0, nplus = 0; for (p0 = SDATA (pattern); *p0; p0++) { @@ -1013,15 +1013,17 @@ ndashes++; else if (*p0 == '*') nstars++; + else if (*p0 == '+') + nplus++; } /* If PATTERN is not full XLFD we conert "*" to ".*". Otherwise we convert "*" to "[^-]*" which is much faster in regular expression matching. */ if (ndashes < 14) - p1 = regex = (unsigned char *) alloca (SBYTES (pattern) + 2 * nstars + 1); + p1 = regex = (unsigned char *) alloca (SBYTES (pattern) + 2 * nstars + 2 * nplus + 1); else - p1 = regex = (unsigned char *) alloca (SBYTES (pattern) + 5 * nstars + 1); + p1 = regex = (unsigned char *) alloca (SBYTES (pattern) + 5 * nstars + 2 * nplus + 1); *p1++ = '^'; for (p0 = SDATA (pattern); *p0; p0++) @@ -1036,6 +1038,8 @@ } else if (*p0 == '?') *p1++ = '.'; + else if (*p0 == '+') + *p1++ = '\\', *p1++ = '+'; else *p1++ = *p0; }