diff options
Diffstat (limited to 'src/alloc.c')
| -rw-r--r-- | src/alloc.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/alloc.c b/src/alloc.c index 88542e86c48..2dbaef9b00b 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -2802,10 +2802,11 @@ allocate_vectorlike (EMACS_INT len) | |||
| 2802 | { | 2802 | { |
| 2803 | struct Lisp_Vector *p; | 2803 | struct Lisp_Vector *p; |
| 2804 | size_t nbytes; | 2804 | size_t nbytes; |
| 2805 | ptrdiff_t nbytes_max = min (PTRDIFF_MAX, SIZE_MAX); | ||
| 2805 | int header_size = offsetof (struct Lisp_Vector, contents); | 2806 | int header_size = offsetof (struct Lisp_Vector, contents); |
| 2806 | int word_size = sizeof p->contents[0]; | 2807 | int word_size = sizeof p->contents[0]; |
| 2807 | 2808 | ||
| 2808 | if ((SIZE_MAX - header_size) / word_size < len) | 2809 | if ((nbytes_max - header_size) / word_size < len) |
| 2809 | memory_full (SIZE_MAX); | 2810 | memory_full (SIZE_MAX); |
| 2810 | 2811 | ||
| 2811 | MALLOC_BLOCK_INPUT; | 2812 | MALLOC_BLOCK_INPUT; |