aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2011-06-15 23:57:02 -0700
committerPaul Eggert2011-06-15 23:57:02 -0700
commit599a9e4f7cec752078570160fe5498fe5799863a (patch)
tree8f9b4c3026a49a568e5bd46fc6ee05d1611f0304 /src
parent9956144405558933e130f39fb631b21985fba998 (diff)
downloademacs-599a9e4f7cec752078570160fe5498fe5799863a.tar.gz
emacs-599a9e4f7cec752078570160fe5498fe5799863a.zip
* insdel.c (replace_range): Fix buf overflow when insbytes < outgoing.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog2
-rw-r--r--src/insdel.c8
2 files changed, 6 insertions, 4 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index f7f18332288..e7ca102421d 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,7 @@
12011-06-16 Paul Eggert <eggert@cs.ucla.edu> 12011-06-16 Paul Eggert <eggert@cs.ucla.edu>
2 2
3 * insdel.c (replace_range): Fix buf overflow when insbytes < outgoing.
4
3 * insdel.c, lisp.h (buffer_overflow): New function. 5 * insdel.c, lisp.h (buffer_overflow): New function.
4 (insert_from_buffer_1, replace_range, replace_range_2): 6 (insert_from_buffer_1, replace_range, replace_range_2):
5 * insdel.c (make_gap_larger): 7 * insdel.c (make_gap_larger):
diff --git a/src/insdel.c b/src/insdel.c
index 875274df8e4..ca53177a3e1 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -1354,8 +1354,8 @@ replace_range (EMACS_INT from, EMACS_INT to, Lisp_Object new,
1354 = count_size_as_multibyte (SDATA (new), insbytes); 1354 = count_size_as_multibyte (SDATA (new), insbytes);
1355 1355
1356 /* Make sure point-max won't overflow after this insertion. */ 1356 /* Make sure point-max won't overflow after this insertion. */
1357 XSETINT (temp, Z_BYTE - nbytes_del + insbytes); 1357 XSETINT (temp, Z_BYTE - nbytes_del + outgoing_insbytes);
1358 if (Z_BYTE - nbytes_del + insbytes != XINT (temp)) 1358 if (Z_BYTE - nbytes_del + outgoing_insbytes != XINT (temp))
1359 buffer_overflow (); 1359 buffer_overflow ();
1360 1360
1361 GCPRO1 (new); 1361 GCPRO1 (new);
@@ -1389,8 +1389,8 @@ replace_range (EMACS_INT from, EMACS_INT to, Lisp_Object new,
1389 if (Z - GPT < END_UNCHANGED) 1389 if (Z - GPT < END_UNCHANGED)
1390 END_UNCHANGED = Z - GPT; 1390 END_UNCHANGED = Z - GPT;
1391 1391
1392 if (GAP_SIZE < insbytes) 1392 if (GAP_SIZE < outgoing_insbytes)
1393 make_gap (insbytes - GAP_SIZE); 1393 make_gap (outgoing_insbytes - GAP_SIZE);
1394 1394
1395 /* Copy the string text into the buffer, perhaps converting 1395 /* Copy the string text into the buffer, perhaps converting
1396 between single-byte and multibyte. */ 1396 between single-byte and multibyte. */