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
599a9e4f
Commit
599a9e4f
authored
Jun 15, 2011
by
Paul Eggert
Browse files
* insdel.c (replace_range): Fix buf overflow when insbytes < outgoing.
parent
99561444
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
4 deletions
+6
-4
src/ChangeLog
src/ChangeLog
+2
-0
src/insdel.c
src/insdel.c
+4
-4
No files found.
src/ChangeLog
View file @
599a9e4f
2011-06-16 Paul Eggert <eggert@cs.ucla.edu>
* insdel.c (replace_range): Fix buf overflow when insbytes < outgoing.
* insdel.c, lisp.h (buffer_overflow): New function.
(insert_from_buffer_1, replace_range, replace_range_2):
* insdel.c (make_gap_larger):
...
...
src/insdel.c
View file @
599a9e4f
...
...
@@ -1354,8 +1354,8 @@ replace_range (EMACS_INT from, EMACS_INT to, Lisp_Object new,
=
count_size_as_multibyte
(
SDATA
(
new
),
insbytes
);
/* Make sure point-max won't overflow after this insertion. */
XSETINT
(
temp
,
Z_BYTE
-
nbytes_del
+
insbytes
);
if
(
Z_BYTE
-
nbytes_del
+
insbytes
!=
XINT
(
temp
))
XSETINT
(
temp
,
Z_BYTE
-
nbytes_del
+
outgoing_
insbytes
);
if
(
Z_BYTE
-
nbytes_del
+
outgoing_
insbytes
!=
XINT
(
temp
))
buffer_overflow
();
GCPRO1
(
new
);
...
...
@@ -1389,8 +1389,8 @@ replace_range (EMACS_INT from, EMACS_INT to, Lisp_Object new,
if
(
Z
-
GPT
<
END_UNCHANGED
)
END_UNCHANGED
=
Z
-
GPT
;
if
(
GAP_SIZE
<
insbytes
)
make_gap
(
insbytes
-
GAP_SIZE
);
if
(
GAP_SIZE
<
outgoing_
insbytes
)
make_gap
(
outgoing_
insbytes
-
GAP_SIZE
);
/* Copy the string text into the buffer, perhaps converting
between single-byte and multibyte. */
...
...
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