From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Barry OReilly Newsgroups: gmane.emacs.bugs Subject: bug#15405: 24.3; #[] freezes emacs Date: Wed, 25 Sep 2013 15:09:22 -0400 Message-ID: References: <8361tynp73.fsf@gnu.org> <834n9inoa0.fsf@gnu.org> <871u4mcf2h.fsf@rosalinde.fritz.box> <831u4mnlit.fsf@gnu.org> <83txhilymg.fsf@gnu.org> <83ob7pmh28.fsf@gnu.org> <523CF65A.7010607@yandex.ru> <52430B74.3080105@yandex.ru> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a11c351acb0ed2704e739fd85 X-Trace: ger.gmane.org 1380136218 15048 80.91.229.3 (25 Sep 2013 19:10:18 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 25 Sep 2013 19:10:18 +0000 (UTC) Cc: Dmitry Antipov , 15405@debbugs.gnu.org, Leo Liu , stephen.berman@gmx.net To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Sep 25 21:10:21 2013 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 1VOuTb-0005Iy-R0 for geb-bug-gnu-emacs@m.gmane.org; Wed, 25 Sep 2013 21:10:20 +0200 Original-Received: from localhost ([::1]:54409 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VOuTb-0003Tb-Au for geb-bug-gnu-emacs@m.gmane.org; Wed, 25 Sep 2013 15:10:19 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37983) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VOuTS-0003TC-IE for bug-gnu-emacs@gnu.org; Wed, 25 Sep 2013 15:10:16 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VOuTM-0003Kc-He for bug-gnu-emacs@gnu.org; Wed, 25 Sep 2013 15:10:10 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:55823) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VOuTM-0003K4-FZ for bug-gnu-emacs@gnu.org; Wed, 25 Sep 2013 15:10:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1VOuTL-00083x-Mc for bug-gnu-emacs@gnu.org; Wed, 25 Sep 2013 15:10:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Barry OReilly Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 25 Sep 2013 19:10:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15405 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 15405-submit@debbugs.gnu.org id=B15405.138013616730940 (code B ref 15405); Wed, 25 Sep 2013 19:10:03 +0000 Original-Received: (at 15405) by debbugs.gnu.org; 25 Sep 2013 19:09:27 +0000 Original-Received: from localhost ([127.0.0.1]:35881 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VOuSk-00082y-W0 for submit@debbugs.gnu.org; Wed, 25 Sep 2013 15:09:27 -0400 Original-Received: from mail-wi0-f175.google.com ([209.85.212.175]:32841) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VOuSh-00082o-1B for 15405@debbugs.gnu.org; Wed, 25 Sep 2013 15:09:23 -0400 Original-Received: by mail-wi0-f175.google.com with SMTP id ez12so5945695wid.14 for <15405@debbugs.gnu.org>; Wed, 25 Sep 2013 12:09:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=rPkVeek0r8A0ElGUR1yJsBAzIjQM/Rdkls1w+whuzpE=; b=TkxxT3EW83HDl3vScJFK1le2pdxgHYNxF/PuSYF5WjTsIILrGfrU4t1M0rPhyak1Hx LtOYrhq+9dBzRgawywlpO31SNRtodsD9PRDayPX9MGwm33XXZVfJ7NqfJwgpeI02EJEe FuJ3RYUD30m+pOBNSVb1rVMjzLUy5MVb9YdczbLLrv3hocKnjSGDhnbmvwekq+11KLxz WGM4dPDLbgUKQLUFMms4YJWZ6seJ/6xlIkFZtFVXFhS/mEpDo02OZJrnBGyLHoFG1tvn 1TYGhqIIMCriQTm+F5ygTcQiWHOv7wQz3f66dL79xXVTICwIP4viuf0x0zxidQxJAcZG pHcA== X-Received: by 10.180.12.243 with SMTP id b19mr23940941wic.18.1380136162222; Wed, 25 Sep 2013 12:09:22 -0700 (PDT) Original-Received: by 10.194.17.72 with HTTP; Wed, 25 Sep 2013 12:09:22 -0700 (PDT) In-Reply-To: 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:78742 Archived-At: --001a11c351acb0ed2704e739fd85 Content-Type: text/plain; charset=ISO-8859-1 How's this? Also, when I was looking over the vector alloc code, I found a case where I think int should be size_t. diff --git a/src/alloc.c b/src/alloc.c index ca21ba2..5b63383 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -2889,7 +2889,7 @@ sweep_vectors (void) free_this_block = 1; else { - int tmp; + size_t tmp; SETUP_ON_FREE_LIST (vector, total_bytes, tmp); } } @@ -3132,6 +3132,8 @@ usage: (vector &rest OBJECTS) */) void make_byte_code (struct Lisp_Vector *v) { + /* Don't allow the global zero_vector to become a byte code object. */ + eassert(v->header.size!=0); if (v->header.size > 1 && STRINGP (v->u.contents[1]) && STRING_MULTIBYTE (v->u.contents[1])) /* BYTECODE-STRING must have been produced by Emacs 20.2 or the diff --git a/src/lread.c b/src/lread.c index 017dfcb..fe2b92a 100644 --- a/src/lread.c +++ b/src/lread.c @@ -2597,7 +2597,10 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) build them using function calls. */ Lisp_Object tmp; tmp = read_vector (readcharfun, 1); - make_byte_code (XVECTOR (tmp)); + struct Lisp_Vector* vec = XVECTOR (tmp); + if (vec->header.size==0) + invalid_syntax ("Empty byte-code object"); + make_byte_code (vec); return tmp; } if (c == '(') --001a11c351acb0ed2704e739fd85 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
How's this?

Also, when I was looking over the v= ector alloc code, I found a case
where I think int should be size_t.
=
diff --git a/src/alloc.c b/src/alloc.c
index ca21ba2..5b63383 100644=
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -2889,7 +2889,7 @@ sweep_vecto= rs (void)
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 free_this_block = =3D 1;
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 else
=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 {
-=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0 int tmp;
+=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 = size_t tmp;
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 SETUP_ON_FREE_LIST (vec= tor, total_bytes, tmp);
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 }<= br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 }
@@ -3132,6 +3132,8 @@ usage: (vec= tor &rest OBJECTS)=A0 */)
=A0void
=A0make_byte_code (struct Lisp_= Vector *v)
=A0{
+=A0 /* Don't allow the global zero_vector to become a byte cod= e object. */
+=A0 eassert(v->header.size!=3D0);
=A0=A0 if (v->h= eader.size > 1 && STRINGP (v->u.contents[1])
=A0=A0=A0=A0= =A0=A0 && STRING_MULTIBYTE (v->u.contents[1]))
=A0=A0=A0=A0 /* BYTECODE-STRING must have been produced by Emacs 20.2 or th= e
diff --git a/src/lread.c b/src/lread.c
index 017dfcb..fe2b92a 10064= 4
--- a/src/lread.c
+++ b/src/lread.c
@@ -2597,7 +2597,10 @@ read1= (Lisp_Object readcharfun, int *pch, bool first_in_list)
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 build them using function calls.=A0 */=
=A0=A0=A0=A0=A0=A0=A0=A0=A0 Lisp_Object tmp;
=A0=A0=A0=A0=A0=A0=A0= =A0=A0 tmp =3D read_vector (readcharfun, 1);
-=A0=A0=A0=A0=A0=A0=A0=A0 m= ake_byte_code (XVECTOR (tmp));
+=A0=A0=A0=A0=A0=A0=A0=A0 struct Lisp_Vec= tor* vec =3D XVECTOR (tmp);
+=A0=A0=A0=A0=A0=A0=A0=A0 if (vec->header.size=3D=3D0)
+=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0 invalid_syntax ("Empty byte-code object");
= +=A0=A0=A0=A0=A0=A0=A0=A0 make_byte_code (vec);
=A0=A0=A0=A0=A0=A0=A0=A0= =A0 return tmp;
=A0=A0=A0=A0=A0=A0=A0 }
=A0=A0=A0=A0=A0=A0 if (c =3D= =3D '(')

--001a11c351acb0ed2704e739fd85--