Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
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
Options
Browse Files
Download
Email Patches
Plain Diff
* 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>
* fns.c (Ffillarray): Don't assume bool vector size fits in 'int'.
* alloc.c (Fmake_bool_vector): Avoid unnecessary multiplication.
* 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. */)
else
if
(
BOOL_VECTOR_P
(
array
))
{
register
unsigned
char
*
p
=
XBOOL_VECTOR
(
array
)
->
data
;
int
size_in_chars
=
((
XBOOL_VECTOR
(
array
)
->
size
+
BOOL_VECTOR_BITS_PER_CHAR
-
1
)
EMACS_INT
size
=
XBOOL_VECTOR
(
array
)
->
size
;
EMACS_INT
size_in_chars
=
((
size
+
BOOL_VECTOR_BITS_PER_CHAR
-
1
)
/
BOOL_VECTOR_BITS_PER_CHAR
);
charval
=
(
!
NILP
(
item
)
?
-
1
:
0
);
for
(
idx
=
0
;
idx
<
size_in_chars
-
1
;
idx
++
)
p
[
idx
]
=
charval
;
if
(
idx
<
size_in_chars
)
if
(
size_in_chars
)
{
/* Mask out bits beyond the vector size. */
if
(
XBOOL_VECTOR
(
array
)
->
size
%
BOOL_VECTOR_BITS_PER_CHAR
)
charval
&=
(
1
<<
(
XBOOL_VECTOR
(
array
)
->
size
%
BOOL_VECTOR_BITS_PER_CHAR
))
-
1
;
p
[
idx
]
=
charval
;
memset
(
p
,
!
NILP
(
item
)
?
-
1
:
0
,
size_in_chars
);
/* Clear any extraneous bits in the last byte. */
p
[
size_in_chars
-
1
]
&
=
(
1
<<
(
size
%
BOOL_VECTOR_BITS_PER_CHAR
))
-
1
;
}
}
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