bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#15405: 24.3; #[] freezes emacs


From: Barry OReilly
Subject: bug#15405: 24.3; #[] freezes emacs
Date: Wed, 25 Sep 2013 15:09:22 -0400

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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]