diff options
| author | Paul Eggert | 2011-06-08 10:43:47 -0700 |
|---|---|---|
| committer | Paul Eggert | 2011-06-08 10:43:47 -0700 |
| commit | c78baabfc2e52a99d85d2e28f8f67d75e4d93778 (patch) | |
| tree | ade8fd6d593e23dcb6ba3f0fec95997a39670fd8 /src | |
| parent | c9d624c605059127505b6d4baec8f07d6ff731d9 (diff) | |
| download | emacs-c78baabfc2e52a99d85d2e28f8f67d75e4d93778.tar.gz emacs-c78baabfc2e52a99d85d2e28f8f67d75e4d93778.zip | |
* alloc.c (Fmake_bool_vector): Don't assume vector size fits in int.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 3 | ||||
| -rw-r--r-- | src/alloc.c | 5 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 64f346baa98..6da301c9d07 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,7 @@ | |||
| 1 | 2011-06-08 Paul Eggert <eggert@cs.ucla.edu> | 1 | 2011-06-08 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 2 | ||
| 3 | * alloc.c (Fmake_bool_vector): Don't assume vector size fits in int. | ||
| 4 | |||
| 3 | * alloc.c: Catch some string size overflows that we were missing. | 5 | * alloc.c: Catch some string size overflows that we were missing. |
| 4 | (XMALLOC_OVERRUN_CHECK_SIZE) [!XMALLOC_OVERRUN_CHECK]: Define to 0, | 6 | (XMALLOC_OVERRUN_CHECK_SIZE) [!XMALLOC_OVERRUN_CHECK]: Define to 0, |
| 5 | for convenience in STRING_BYTES_MAX. | 7 | for convenience in STRING_BYTES_MAX. |
| @@ -10,6 +12,7 @@ | |||
| 10 | size_t overflow on (unusual) hosts where SIZE_MAX <= min | 12 | size_t overflow on (unusual) hosts where SIZE_MAX <= min |
| 11 | (PTRDIFF_MAX, MOST_POSITIVE_FIXNUM), e.g., when size_t is 32 bits | 13 | (PTRDIFF_MAX, MOST_POSITIVE_FIXNUM), e.g., when size_t is 32 bits |
| 12 | and ptrdiff_t and EMACS_INT are both 64 bits. | 14 | and ptrdiff_t and EMACS_INT are both 64 bits. |
| 15 | |||
| 13 | * character.c, coding.c, doprnt.c, editfns.c, eval.c: | 16 | * character.c, coding.c, doprnt.c, editfns.c, eval.c: |
| 14 | All uses of STRING_BYTES_MAX replaced by STRING_BYTES_BOUND. | 17 | All uses of STRING_BYTES_MAX replaced by STRING_BYTES_BOUND. |
| 15 | * lisp.h (STRING_BYTES_BOUND): Renamed from STRING_BYTES_MAX. | 18 | * lisp.h (STRING_BYTES_BOUND): Renamed from STRING_BYTES_MAX. |
diff --git a/src/alloc.c b/src/alloc.c index fa4f1d38130..88542e86c48 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -2246,7 +2246,6 @@ LENGTH must be a number. INIT matters only in whether it is t or nil. */) | |||
| 2246 | { | 2246 | { |
| 2247 | register Lisp_Object val; | 2247 | register Lisp_Object val; |
| 2248 | struct Lisp_Bool_Vector *p; | 2248 | struct Lisp_Bool_Vector *p; |
| 2249 | int real_init, i; | ||
| 2250 | EMACS_INT length_in_chars, length_in_elts; | 2249 | EMACS_INT length_in_chars, length_in_elts; |
| 2251 | int bits_per_value; | 2250 | int bits_per_value; |
| 2252 | 2251 | ||
| @@ -2268,9 +2267,7 @@ LENGTH must be a number. INIT matters only in whether it is t or nil. */) | |||
| 2268 | p = XBOOL_VECTOR (val); | 2267 | p = XBOOL_VECTOR (val); |
| 2269 | p->size = XFASTINT (length); | 2268 | p->size = XFASTINT (length); |
| 2270 | 2269 | ||
| 2271 | real_init = (NILP (init) ? 0 : -1); | 2270 | memset (p->data, NILP (init) ? 0 : -1, length_in_chars); |
| 2272 | for (i = 0; i < length_in_chars ; i++) | ||
| 2273 | p->data[i] = real_init; | ||
| 2274 | 2271 | ||
| 2275 | /* Clear the extraneous bits in the last byte. */ | 2272 | /* Clear the extraneous bits in the last byte. */ |
| 2276 | if (XINT (length) != length_in_chars * BOOL_VECTOR_BITS_PER_CHAR) | 2273 | if (XINT (length) != length_in_chars * BOOL_VECTOR_BITS_PER_CHAR) |