unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Barry OReilly <gundaetiapo@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Dmitry Antipov <dmantipov@yandex.ru>,
	15405@debbugs.gnu.org, Leo Liu <sdl.web@gmail.com>,
	stephen.berman@gmx.net
Subject: bug#15405: 24.3; #[] freezes emacs
Date: Wed, 25 Sep 2013 15:09:22 -0400	[thread overview]
Message-ID: <CAFM41H26-1K_Rxf4C_tVCWS9mYw=kprXJKwarV-orDw8706BZg@mail.gmail.com> (raw)
In-Reply-To: <jwvvc1ovm8a.fsf-monnier+emacsbugs@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 1458 bytes --]

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 == '(')

[-- Attachment #2: Type: text/html, Size: 1690 bytes --]

  reply	other threads:[~2013-09-25 19:09 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-18  1:50 bug#15405: 24.3; #[] freezes emacs Leo Liu
2013-09-18  7:23 ` Andreas Schwab
2013-09-18 14:36 ` Barry OReilly
2013-09-18 15:07   ` Eli Zaretskii
2013-09-18 15:14     ` Barry OReilly
2013-09-18 15:27       ` Eli Zaretskii
2013-09-18 15:41         ` Stephen Berman
2013-09-18 16:26           ` Eli Zaretskii
2013-09-18 17:31             ` Barry OReilly
2013-09-18 19:26               ` Eli Zaretskii
2013-09-18 23:20                 ` Barry OReilly
2013-09-19  7:00                   ` Eli Zaretskii
2013-09-20 15:33                     ` Barry OReilly
2013-09-20 16:13                       ` Barry OReilly
2013-09-20 16:21                         ` Drew Adams
2013-09-20 19:09                       ` Stefan Monnier
2013-09-20 19:43                         ` Barry OReilly
2013-09-20 21:26                           ` Stefan Monnier
2013-09-20 21:38                             ` Barry OReilly
2013-09-21  1:28                               ` Dmitry Antipov
2013-09-21  1:39                                 ` Dmitry Antipov
2013-09-21  2:51                                 ` Stefan Monnier
2013-09-25 15:22                                   ` Barry OReilly
2013-09-25 16:12                                     ` Dmitry Antipov
2013-09-25 17:35                                       ` Stefan Monnier
2013-09-25 19:09                                         ` Barry OReilly [this message]
2013-09-25 21:50                                           ` Dmitry Antipov
2013-09-26  1:15                                           ` Stefan Monnier
2013-09-26  3:51                                             ` Barry OReilly
2013-09-25 17:10                                     ` Stefan Monnier
2013-09-18 23:41                 ` Barry OReilly
2013-09-18 17:57             ` Stephen Berman

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='CAFM41H26-1K_Rxf4C_tVCWS9mYw=kprXJKwarV-orDw8706BZg@mail.gmail.com' \
    --to=gundaetiapo@gmail.com \
    --cc=15405@debbugs.gnu.org \
    --cc=dmantipov@yandex.ru \
    --cc=monnier@iro.umontreal.ca \
    --cc=sdl.web@gmail.com \
    --cc=stephen.berman@gmx.net \
    /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).