From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Bob Halley Newsgroups: gmane.emacs.devel Subject: Re: wrong-type-argument charsetp unbound error in emacs-unicode-2 current Date: Sun, 05 Nov 2006 23:04:07 -0800 Message-ID: <454EDE67.5040608@play-bow.org> References: <454BA125.300@play-bow.org> <454CD2D5.2020609@play-bow.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------070000060808090709020405" X-Trace: sea.gmane.org 1162796671 26866 80.91.229.2 (6 Nov 2006 07:04:31 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 6 Nov 2006 07:04:31 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Nov 06 08:04:27 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GgyWv-0002wN-Vs for ged-emacs-devel@m.gmane.org; Mon, 06 Nov 2006 08:04:26 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GgyWv-00034J-GW for ged-emacs-devel@m.gmane.org; Mon, 06 Nov 2006 02:04:25 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GgyWj-00033k-OL for emacs-devel@gnu.org; Mon, 06 Nov 2006 02:04:13 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GgyWi-00033V-9D for emacs-devel@gnu.org; Mon, 06 Nov 2006 02:04:13 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GgyWi-00033S-5u for emacs-devel@gnu.org; Mon, 06 Nov 2006 02:04:12 -0500 Original-Received: from [204.152.189.147] (helo=woof.play-bow.org) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GgyWg-0000Vq-0W for emacs-devel@gnu.org; Mon, 06 Nov 2006 02:04:11 -0500 Original-Received: from [24.5.129.155] (c-24-5-129-155.hsd1.ca.comcast.net [24.5.129.155]) by woof.play-bow.org (Postfix) with ESMTP id 2F180510102 for ; Sun, 5 Nov 2006 23:04:08 -0800 (PST) User-Agent: Thunderbird 1.5.0.7 (X11/20060909) Original-To: emacs-devel@gnu.org In-Reply-To: <454CD2D5.2020609@play-bow.org> 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:61853 Archived-At: This is a multi-part message in MIME format. --------------070000060808090709020405 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit I ran emacs under gdb, stepping through Fccl_execute_on_string. When doing the "is this a utf-8 string" test on "foo", I caught it doing a massive character copy of millions of characters. This happened because ccl.produced was a large number (around 5 million). I then went looking for a reason for ccl.produced to be so wrong. The CCL program in question has a "buffer magnification" of zero, which means "produce no bytes". In this case the current destination pointer, dst, is set to NULL. A NULL dst causes the calculation of ccl->produced just after the ccl_finish tag in ccl_driver() to be wrong, because the code does ccl->produced = dst - destination I changed this code (patch attached) so that it set ccl->produced to zero if dst was NULL. With this change, both the type error and the segfault no longer happen. (The type error is fixed because we're no longer reading random memory and treating it as encoded characters.) Regards, /Bob --------------070000060808090709020405 Content-Type: text/x-patch; name="ccl.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="ccl.patch" Index: src/ccl.c =================================================================== RCS file: /sources/emacs/emacs/src/ccl.c,v retrieving revision 1.82.4.14 diff -u -r1.82.4.14 ccl.c --- src/ccl.c 3 Mar 2006 05:13:48 -0000 1.82.4.14 +++ src/ccl.c 6 Nov 2006 06:50:23 -0000 @@ -1782,7 +1782,10 @@ ccl->stack_idx = stack_idx; ccl->prog = ccl_prog; ccl->consumed = src - source; - ccl->produced = dst - destination; + if (dst != NULL) + ccl->produced = dst - destination; + else + ccl->produced = 0; } /* Resolve symbols in the specified CCL code (Lisp vector). This --------------070000060808090709020405 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel --------------070000060808090709020405--