Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 38E6340BC61 for ; Mon, 16 Aug 2010 10:41:27 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -1.9 X-Spam-Level: X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5 tests=[BAYES_00=-1.9] autolearn=unavailable Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KzLGM+cfbwQ0 for ; Mon, 16 Aug 2010 10:41:16 -0700 (PDT) Received: from pantheon-po45.its.yale.edu (pantheon-po45.its.yale.edu [130.132.50.79]) by olra.theworths.org (Postfix) with ESMTP id D197840BC64 for ; Mon, 16 Aug 2010 10:41:16 -0700 (PDT) Received: from furry ([64.134.241.146]) (authenticated bits=0) by pantheon-po45.its.yale.edu (8.12.11.20060308/8.12.11) with ESMTP id o7GHekVB003001 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Mon, 16 Aug 2010 13:40:49 -0400 Received: by furry (Postfix, from userid 1000) id 71ED6C013; Mon, 16 Aug 2010 13:40:13 -0400 (EDT) From: Chong Yidong To: Michal Sojka Subject: Re: bug#6214: 23.1; json-read-string crashes emacs with long string References: <87pr0t5h1q.fsf@yoom.home.cworth.org> <87fx1pkrsh.fsf@stupidchicken.com> <87tymzv6ga.fsf@steelpick.2x.cz> <878w4afozw.fsf@stupidchicken.com> <87sk2hbq3s.fsf@steelpick.2x.cz> <8739ug3mrr.fsf@stupidchicken.com> <87r5i02uo7.fsf@steelpick.2x.cz> Date: Mon, 16 Aug 2010 13:40:13 -0400 In-Reply-To: <87r5i02uo7.fsf@steelpick.2x.cz> (Michal Sojka's message of "Sun, 15 Aug 2010 09:37:28 +0200") Message-ID: <874oeuv4le.fsf@stupidchicken.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-YaleITSMailFilter: Version 1.2c (attachment(s) not renamed) Cc: 6214@debbugs.gnu.org, Notmuch mailing list X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Aug 2010 17:41:27 -0000 Thanks, that is a useful backtrace. Could you apply this patch and see if it fixes the problem? === modified file 'src/eval.c' *** src/eval.c 2010-08-06 19:07:16 +0000 --- src/eval.c 2010-08-16 17:37:22 +0000 *************** *** 2430,2437 **** register int i, numargs; register Lisp_Object spread_arg; register Lisp_Object *funcall_args; ! Lisp_Object fun; struct gcpro gcpro1; fun = args [0]; funcall_args = 0; --- 2430,2438 ---- register int i, numargs; register Lisp_Object spread_arg; register Lisp_Object *funcall_args; ! Lisp_Object fun, retval; struct gcpro gcpro1; + USE_SAFE_ALLOCA; fun = args [0]; funcall_args = 0; *************** *** 2470,2477 **** { /* Avoid making funcall cons up a yet another new vector of arguments by explicitly supplying nil's for optional values */ ! funcall_args = (Lisp_Object *) alloca ((1 + XSUBR (fun)->max_args) ! * sizeof (Lisp_Object)); for (i = numargs; i < XSUBR (fun)->max_args;) funcall_args[++i] = Qnil; GCPRO1 (*funcall_args); --- 2471,2478 ---- { /* Avoid making funcall cons up a yet another new vector of arguments by explicitly supplying nil's for optional values */ ! SAFE_ALLOCA (funcall_args, Lisp_Object *, ((1 + XSUBR (fun)->max_args) ! * sizeof (Lisp_Object))); for (i = numargs; i < XSUBR (fun)->max_args;) funcall_args[++i] = Qnil; GCPRO1 (*funcall_args); *************** *** 2483,2490 **** function itself as well as its arguments. */ if (!funcall_args) { ! funcall_args = (Lisp_Object *) alloca ((1 + numargs) ! * sizeof (Lisp_Object)); GCPRO1 (*funcall_args); gcpro1.nvars = 1 + numargs; } --- 2484,2491 ---- function itself as well as its arguments. */ if (!funcall_args) { ! SAFE_ALLOCA (funcall_args, Lisp_Object *, ((1 + numargs) ! * sizeof (Lisp_Object))); GCPRO1 (*funcall_args); gcpro1.nvars = 1 + numargs; } *************** *** 2500,2506 **** } /* By convention, the caller needs to gcpro Ffuncall's args. */ ! RETURN_UNGCPRO (Ffuncall (gcpro1.nvars, funcall_args)); } /* Run hook variables in various ways. */ --- 2501,2511 ---- } /* By convention, the caller needs to gcpro Ffuncall's args. */ ! retval = Ffuncall (gcpro1.nvars, funcall_args); ! UNGCPRO; ! SAFE_FREE (); ! ! return retval; } /* Run hook variables in various ways. */