diff options
| author | Paul Eggert | 2018-12-08 16:56:32 -0800 |
|---|---|---|
| committer | Paul Eggert | 2018-12-08 16:58:40 -0800 |
| commit | 7bcea8f8c11d10fd189c4250042dfe68e2df8c3a (patch) | |
| tree | 3676ecf2fccc0b7c4dede99487274931c1214784 /src/lisp.h | |
| parent | a9732737f2b48a78de72d67f6ed950495788ed1d (diff) | |
| download | emacs-7bcea8f8c11d10fd189c4250042dfe68e2df8c3a.tar.gz emacs-7bcea8f8c11d10fd189c4250042dfe68e2df8c3a.zip | |
Streamline and fix vector-size checks
* src/alloc.c (VECTOR_ELTS_MAX): New constant.
(allocate_vectorlike): LEN now must be positive. Assume LEN
is in range. All callers changed.
(allocate_vector): Arg is now ptrdiff_t, not EMACS_INT.
All callers changed. Return zero vector here, not in
allocate_vectorlike.
* src/lisp.h (make_uninit_vector): Simplify.
* src/xwidget.c (webkit_js_to_lisp):
Check for overflow in ptrdiff_t calculations.
Diffstat (limited to 'src/lisp.h')
| -rw-r--r-- | src/lisp.h | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/src/lisp.h b/src/lisp.h index 7e7dba631f3..77b8b63e196 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -3695,7 +3695,7 @@ build_string (const char *str) | |||
| 3695 | 3695 | ||
| 3696 | extern Lisp_Object pure_cons (Lisp_Object, Lisp_Object); | 3696 | extern Lisp_Object pure_cons (Lisp_Object, Lisp_Object); |
| 3697 | extern void make_byte_code (struct Lisp_Vector *); | 3697 | extern void make_byte_code (struct Lisp_Vector *); |
| 3698 | extern struct Lisp_Vector *allocate_vector (EMACS_INT); | 3698 | extern struct Lisp_Vector *allocate_vector (ptrdiff_t); |
| 3699 | 3699 | ||
| 3700 | /* Make an uninitialized vector for SIZE objects. NOTE: you must | 3700 | /* Make an uninitialized vector for SIZE objects. NOTE: you must |
| 3701 | be sure that GC cannot happen until the vector is completely | 3701 | be sure that GC cannot happen until the vector is completely |
| @@ -3709,12 +3709,7 @@ extern struct Lisp_Vector *allocate_vector (EMACS_INT); | |||
| 3709 | INLINE Lisp_Object | 3709 | INLINE Lisp_Object |
| 3710 | make_uninit_vector (ptrdiff_t size) | 3710 | make_uninit_vector (ptrdiff_t size) |
| 3711 | { | 3711 | { |
| 3712 | Lisp_Object v; | 3712 | return make_lisp_ptr (allocate_vector (size), Lisp_Vectorlike); |
| 3713 | struct Lisp_Vector *p; | ||
| 3714 | |||
| 3715 | p = allocate_vector (size); | ||
| 3716 | XSETVECTOR (v, p); | ||
| 3717 | return v; | ||
| 3718 | } | 3713 | } |
| 3719 | 3714 | ||
| 3720 | /* Like above, but special for sub char-tables. */ | 3715 | /* Like above, but special for sub char-tables. */ |