Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
b4e50fa0
Commit
b4e50fa0
authored
Jun 18, 2011
by
Paul Eggert
Browse files
* fns.c (Ffillarray): Don't assume bool vector size fits in 'int'.
parent
c0c1ee9f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
10 deletions
+10
-10
src/ChangeLog
src/ChangeLog
+2
-0
src/fns.c
src/fns.c
+8
-10
No files found.
src/ChangeLog
View file @
b4e50fa0
2011-06-18 Paul Eggert <eggert@cs.ucla.edu>
2011-06-18 Paul Eggert <eggert@cs.ucla.edu>
* fns.c (Ffillarray): Don't assume bool vector size fits in 'int'.
* alloc.c (Fmake_bool_vector): Avoid unnecessary multiplication.
* alloc.c (Fmake_bool_vector): Avoid unnecessary multiplication.
* fns.c (concat): Catch string overflow earlier.
* fns.c (concat): Catch string overflow earlier.
...
...
src/fns.c
View file @
b4e50fa0
...
@@ -2188,19 +2188,17 @@ ARRAY is a vector, string, char-table, or bool-vector. */)
...
@@ -2188,19 +2188,17 @@ ARRAY is a vector, string, char-table, or bool-vector. */)
else if (BOOL_VECTOR_P (array))
else if (BOOL_VECTOR_P (array))
{
{
register unsigned char *p = XBOOL_VECTOR (array)->data;
register unsigned char *p = XBOOL_VECTOR (array)->data;
int size_in_chars
EMACS_INT size = XBOOL_VECTOR (array)->size;
= ((XBOOL_VECTOR (array)->size + BOOL_VECTOR_BITS_PER_CHAR - 1)
EMACS_INT size_in_chars
= ((size + BOOL_VECTOR_BITS_PER_CHAR - 1)
/ BOOL_VECTOR_BITS_PER_CHAR);
/ BOOL_VECTOR_BITS_PER_CHAR);
charval = (! NILP (item) ? -1 : 0);
if (size_in_chars)
for (idx = 0; idx < size_in_chars - 1; idx++)
p[idx] = charval;
if (idx < size_in_chars)
{
{
/* Mask out bits beyond the vector size. */
memset (p, ! NILP (item) ? -1 : 0, size_in_chars);
if (XBOOL_VECTOR (array)->size % BOOL_VECTOR_BITS_PER_CHAR)
charval &= (1 << (XBOOL_VECTOR (array)->size % BOOL_VECTOR_BITS_PER_CHAR)) - 1;
/* Clear any extraneous bits in the last byte. */
p[
idx
] =
charval
;
p[
size_in_chars - 1
]
&
=
(1 << (size % BOOL_VECTOR_BITS_PER_CHAR)) - 1
;
}
}
}
}
else
else
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment