Commit 02f303d7 authored by Paul Eggert's avatar Paul Eggert
Browse files

Fix failed assertion when load-force-doc-strings

Problem reported by Philipp Stephani (Bug#31556).
* src/lread.c (read_vector): When load_force_doc_strings, check
for byte code vectors that are invalid because they are too short.
* test/src/lread-tests.el (lread-invalid-bytecodes): New test.
parent a5172528
......@@ -3829,9 +3829,11 @@ read_vector (Lisp_Object readcharfun, bool bytecodeflag)
tem = read_list (1, readcharfun);
len = Flength (tem);
if (bytecodeflag && XFASTINT (len) <= COMPILED_STACK_DEPTH)
error ("Invalid byte code");
vector = Fmake_vector (len, Qnil);
size = ASIZE (vector);
size = XFASTINT (len);
ptr = XVECTOR (vector)->contents;
for (i = 0; i < size; i++)
{
......
......@@ -207,4 +207,8 @@ literals (Bug#20852)."
;; bug was fixed.
(eval-buffer))))
(ert-deftest lread-invalid-bytecodes ()
(should-error
(let ((load-force-doc-strings t)) (read "#[0 \"\"]"))))
;;; lread-tests.el ends here
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment