unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Chong Yidong <cyd@stupidchicken.com>
To: Michal Sojka <sojkam1@fel.cvut.cz>
Cc: 6214@debbugs.gnu.org,
	Notmuch mailing list <notmuch@notmuchmail.org>,
	Carl Worth <cworth@cworth.org>
Subject: bug#6214: 23.1; json-read-string crashes emacs with long string
Date: Mon, 16 Aug 2010 13:40:13 -0400	[thread overview]
Message-ID: <874oeuv4le.fsf__16988.7649747126$1281982204$gmane$org@stupidchicken.com> (raw)
In-Reply-To: <87r5i02uo7.fsf@steelpick.2x.cz> (Michal Sojka's message of "Sun,  15 Aug 2010 09:37:28 +0200")

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));
  }
  \f
  /* 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;
  }
  \f
  /* Run hook variables in various ways.  */






  parent reply	other threads:[~2010-08-16 17:40 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-18 16:08 23.1; json-read-string crashes emacs with long string Carl Worth
2010-05-18 17:16 ` bug#6214: " Leo
2010-05-18 17:43 ` bug#6214: `bt full' output Nelson Elhage
2010-05-18 18:07 ` bug#6214: 23.1; json-read-string crashes emacs with long string Chong Yidong
2010-08-12 21:58   ` Michal Sojka
     [not found]   ` <87tymzv6ga.fsf@steelpick.2x.cz>
2010-08-13 16:37     ` Chong Yidong
2010-08-14  7:39       ` Michal Sojka
     [not found]       ` <87sk2hbq3s.fsf@steelpick.2x.cz>
2010-08-14 21:30         ` Chong Yidong
     [not found]         ` <8739ug3mrr.fsf@stupidchicken.com>
2010-08-15  7:37           ` Michal Sojka
     [not found]           ` <87r5i02uo7.fsf@steelpick.2x.cz>
2010-08-16 17:40             ` Chong Yidong [this message]
     [not found]             ` <874oeuv4le.fsf@stupidchicken.com>
2010-08-16 20:39               ` Michal Sojka
     [not found]               ` <87fwye2sxt.fsf@steelpick.2x.cz>
2010-08-17 15:10                 ` Chong Yidong
     [not found]                 ` <87pqxhmg0i.fsf@stupidchicken.com>
2010-08-17 16:27                   ` Chong Yidong
     [not found]                   ` <87sk2dxl01.fsf@stupidchicken.com>
2010-08-17 20:57                     ` Andreas Schwab
2010-08-17 21:46                       ` Chong Yidong
     [not found] ` <handler.6214.D6214.12742060387114.notifdone@debbugs.gnu.org>
2010-05-18 19:15   ` bug#6214: closed (Re: bug#6214: 23.1; json-read-string crashes emacs with long string) Carl Worth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='874oeuv4le.fsf__16988.7649747126$1281982204$gmane$org@stupidchicken.com' \
    --to=cyd@stupidchicken.com \
    --cc=6214@debbugs.gnu.org \
    --cc=cworth@cworth.org \
    --cc=notmuch@notmuchmail.org \
    --cc=sojkam1@fel.cvut.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).