Signal error when reading an empty byte-code object (Bug#15405)

* lread.c (read1): signal error
* alloc.c (make_byte_code): eassert header size
(sweep_vectors): change an int to size_t
This commit is contained in:
Barry O'Reilly 2013-09-25 23:46:47 -04:00
parent 3958758036
commit ba355de014
3 changed files with 14 additions and 2 deletions

View file

@ -1,3 +1,10 @@
2013-09-26 Barry O'Reilly <gundaetiapo@gmail.com>
Signal error when reading an empty byte-code object (Bug#15405)
* lread.c (read1): signal error
* alloc.c (make_byte_code): eassert header size
(sweep_vectors): change an int to size_t
2013-09-24 Paul Eggert <eggert@cs.ucla.edu>
* dispnew.c (clear_glyph_row, copy_row_except_pointers): Use enums

View file

@ -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(0 < v->header.size);
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

View file

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