diff options
| author | Paul Eggert | 2012-07-18 10:29:34 -0700 |
|---|---|---|
| committer | Paul Eggert | 2012-07-18 10:29:34 -0700 |
| commit | 837131548b13935cc7a2cbb7114bfb0ee44eae76 (patch) | |
| tree | 7bb353bf366eeaa8006f33e5a2104a73526fce02 /src | |
| parent | d06714cb449d3eb3f58f4ed79053ca173db286fa (diff) | |
| download | emacs-837131548b13935cc7a2cbb7114bfb0ee44eae76.tar.gz emacs-837131548b13935cc7a2cbb7114bfb0ee44eae76.zip | |
* alloc.c (Fmake_bool_vector): Fix off-by-8 bug
when invoking (make-bool-vector N t) and N is a positive
multiple of 8 -- the last 8 bits were mistakenly cleared.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 4 | ||||
| -rw-r--r-- | src/alloc.c | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 3f12159d169..d202e1d3f38 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,9 @@ | |||
| 1 | 2012-07-18 Paul Eggert <eggert@cs.ucla.edu> | 1 | 2012-07-18 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 2 | ||
| 3 | * alloc.c (Fmake_bool_vector): Fix off-by-8 bug | ||
| 4 | when invoking (make-bool-vector N t) and N is a positive | ||
| 5 | multiple of 8 -- the last 8 bits were mistakenly cleared. | ||
| 6 | |||
| 3 | Remove some struct layout assumptions in bool vectors. | 7 | Remove some struct layout assumptions in bool vectors. |
| 4 | * alloc.c (bool_header_size): New constant. | 8 | * alloc.c (bool_header_size): New constant. |
| 5 | (header_size, word_size): Move earlier, as they're now used earlier. | 9 | (header_size, word_size): Move earlier, as they're now used earlier. |
diff --git a/src/alloc.c b/src/alloc.c index 29aabdd4616..a6980e867a7 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -2389,7 +2389,7 @@ LENGTH must be a number. INIT matters only in whether it is t or nil. */) | |||
| 2389 | 2389 | ||
| 2390 | /* Clear any extraneous bits in the last byte. */ | 2390 | /* Clear any extraneous bits in the last byte. */ |
| 2391 | p->data[length_in_chars - 1] | 2391 | p->data[length_in_chars - 1] |
| 2392 | &= (1 << (XINT (length) % BOOL_VECTOR_BITS_PER_CHAR)) - 1; | 2392 | &= (1 << ((XFASTINT (length) - 1) % BOOL_VECTOR_BITS_PER_CHAR + 1)) - 1; |
| 2393 | } | 2393 | } |
| 2394 | 2394 | ||
| 2395 | return val; | 2395 | return val; |