From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: handa@gnu.org (K. Handa) Newsgroups: gmane.emacs.bugs Subject: bug#17881: 24.4.50; decoding by emacs-mule hangs up Date: Wed, 02 Jul 2014 00:44:59 +0900 Message-ID: <87tx71dqx0.fsf@gnu.org> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1404229592 14663 80.91.229.3 (1 Jul 2014 15:46:32 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 1 Jul 2014 15:46:32 +0000 (UTC) Cc: 17881@debbugs.gnu.org, dmantipov@yandex.ru, yamaoka@jpl.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Jul 01 17:46:21 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1X20G9-0001P8-L9 for geb-bug-gnu-emacs@m.gmane.org; Tue, 01 Jul 2014 17:46:17 +0200 Original-Received: from localhost ([::1]:48490 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X20G8-0002im-VU for geb-bug-gnu-emacs@m.gmane.org; Tue, 01 Jul 2014 11:46:17 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59249) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X20G3-0002fE-Sy for bug-gnu-emacs@gnu.org; Tue, 01 Jul 2014 11:46:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X20Fv-0007Yw-0V for bug-gnu-emacs@gnu.org; Tue, 01 Jul 2014 11:46:11 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:48353) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X20Fu-0007Yr-TV for bug-gnu-emacs@gnu.org; Tue, 01 Jul 2014 11:46:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1X20Fu-0008A5-Gr for bug-gnu-emacs@gnu.org; Tue, 01 Jul 2014 11:46:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: handa@gnu.org (K. Handa) Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 01 Jul 2014 15:46:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 17881 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 17881-submit@debbugs.gnu.org id=B17881.140422951831310 (code B ref 17881); Tue, 01 Jul 2014 15:46:02 +0000 Original-Received: (at 17881) by debbugs.gnu.org; 1 Jul 2014 15:45:18 +0000 Original-Received: from localhost ([127.0.0.1]:39503 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1X20F8-00088s-93 for submit@debbugs.gnu.org; Tue, 01 Jul 2014 11:45:18 -0400 Original-Received: from fencepost.gnu.org ([208.118.235.10]:44996 ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1X20F1-00088e-VV for 17881@debbugs.gnu.org; Tue, 01 Jul 2014 11:45:11 -0400 Original-Received: from fl1-125-197-74-119.iba.mesh.ad.jp ([125.197.74.119]:43321 helo=wanchai) by fencepost.gnu.org with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1X20F0-0008Dq-1g; Tue, 01 Jul 2014 11:45:06 -0400 Original-Received: from handa by wanchai with local (Exim 4.80) (envelope-from ) id 1X20Et-0006cX-Q6; Wed, 02 Jul 2014 00:44:59 +0900 In-Reply-To: <83wqby4d8m.fsf@gnu.org> (message from Eli Zaretskii on Mon, 30 Jun 2014 18:40:41 +0300) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:91050 Archived-At: In article <83wqby4d8m.fsf@gnu.org>, Eli Zaretskii writes: > Fixed in trunk revision 117451. Thank you for the quick fix! But, considering the usage of coding->charbuf, I think the following fix is better. It always allocates 16 units more in coding->charbuf. So, as far as it doesn't reach MAX_CHARBUF_SIZE, decoding routines never stop by insufficient coding->charbuf. I'm going to install it as soon as I finish several tests. === modified file 'src/coding.c' --- src/coding.c 2014-06-28 13:38:36 +0000 +++ src/coding.c 2014-07-01 15:27:35 +0000 @@ -7266,13 +7266,17 @@ } #define MAX_CHARBUF_SIZE 0x4000 -#define MIN_CHARBUF_SIZE 0x10 +/* How many units decoding functions expect in coding->charbuf at + most. Currently, decode_coding_emacs_mule expects the following + size, and that is the largest value. */ +#define MAX_CHARBUF_EXTRA_SIZE ((MAX_ANNOTATION_LENGTH * 3) + 1) #define ALLOC_CONVERSION_WORK_AREA(coding, size) \ do { \ - int units = ((size) > MAX_CHARBUF_SIZE ? MAX_CHARBUF_SIZE \ - : (size) < MIN_CHARBUF_SIZE ? MIN_CHARBUF_SIZE \ - : size); \ + int units = (size) + MAX_CHARBUF_EXTRA_SIZE; \ + \ + if (units > MAX_CHARBUF_SIZE) \ + units = MAX_CHARBUF_SIZE; \ coding->charbuf = SAFE_ALLOCA ((units) * sizeof (int)); \ coding->charbuf_size = (units); \ } while (0)