summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2009-11-19 01:40:22 +0000
committerStefan Monnier <monnier@iro.umontreal.ca>2009-11-19 01:40:22 +0000
commit87e32266f0fc8467bc8280c9b73b7c5ab9d5f951 (patch)
treece23ebb18e3d66069782425bbf0ba344d90407f4 /src
parentb2f0be0f79c0275c1677fee1a2ff62c42febc623 (diff)
downloademacs-87e32266f0fc8467bc8280c9b73b7c5ab9d5f951.tar.gz
(make_gap_larger): Don't make as many assumptions about the
representation of Lisp integers. Reported by MJ Chan <mjchan.inbox@gmail.com>.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog32
-rw-r--r--src/insdel.c20
2 files changed, 29 insertions, 23 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 713bfe7d7d6..474bc2e0e26 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
+2009-11-19 Stefan Monnier <monnier@iro.umontreal.ca>
+
+ * insdel.c (make_gap_larger): Don't make as many assumptions about the
+ representation of Lisp integers.
+ Reported by MJ Chan <mjchan.inbox@gmail.com>.
+
2009-11-17 Andreas Schwab <schwab@linux-m68k.org>
* lisp.h: Remove declaration of Ffont_get_system_font.
@@ -6,8 +12,8 @@
2009-11-17 Jan Djärv <jan.h.d@swipnet.se>
- * xsettings.c (something_changedCB, Ffont_get_system_font): Check
- use_system_font.
+ * xsettings.c (something_changedCB, Ffont_get_system_font):
+ Check use_system_font.
(syms_of_xsettings): DEFVAR font-use-system-font.
2009-11-17 Andreas Schwab <schwab@linux-m68k.org>
@@ -18,10 +24,10 @@
2009-11-17 Jan Djärv <jan.h.d@swipnet.se>
- * xftfont.c (xftfont_fix_match): Older versions of fontconfig does
+ * xftfont.c (xftfont_fix_match): Older versions of fontconfig do
not have FC_LCD_*. #define them if not there.
- * xsettings.c (parse_xft_settings, apply_xft_settings): Ditto
+ * xsettings.c (parse_xft_settings, apply_xft_settings): Ditto.
* xterm.h (struct x_display_info): Add atoms and Window for xsettings.
@@ -36,10 +42,11 @@
* xfont.c (xfont_driver): Initialize all members.
- * xfns.c (x_default_font_parameter): Try font from Ffont_get_system_font.
+ * xfns.c (x_default_font_parameter):
+ Try font from Ffont_get_system_font.
Do not get font from x_default_parameter if we got one from
Ffont_get_system_font.
- (Fx_select_font): Get the defaut font name from :name of FRAME_FONT (f).
+ (Fx_select_font): Get the defaut font name from :name of FRAME_FONT(f).
* w32font.c (w32font_driver): Initialize all members.
@@ -47,22 +54,22 @@
* lisp.h: Declare syms_of_xsettings.
- * keyboard.c (kbd_buffer_get_event, make_lispy_event): Handle
- CONFIG_CHANGED_EVENT.
+ * keyboard.c (kbd_buffer_get_event, make_lispy_event):
+ Handle CONFIG_CHANGED_EVENT.
* ftfont.c (ftfont_filter_properties): New function.
* frame.c (x_set_font): Remove unused variable lval.
- * font.h (struct font_driver): filter_properties is new.
+ * font.h (struct font_driver): Add filter_properties.
* font.c (font_put_extra): Don't return if val is nil, it means
boolean option is off.
(font_parse_fcname): Collect all extra properties in extra_props
and call filter_properties for all drivers with extra_props and
font as parameter.
- (font_open_entity): Do not use cache, it does not pick up new fontconfig
- settings like hinting.
+ (font_open_entity): Do not use cache, it does not pick up new
+ fontconfig settings like hinting.
(font_load_for_lface): If spec had a name in it, store it in entity.
* emacs.c (main): Call syms_of_xsettings
@@ -89,8 +96,7 @@
2009-11-14 Andreas Schwab <schwab@linux-m68k.org>
- * Makefile.in: Ignore errors from mkdir when creating deps
- directory.
+ * Makefile.in: Ignore errors from mkdir when creating deps directory.
2009-11-14 Jan Djärv <jan.h.d@swipnet.se>
diff --git a/src/insdel.c b/src/insdel.c
index bdd450558bd..0faf3c07227 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -512,16 +512,16 @@ make_gap_larger (EMACS_INT nbytes_added)
/* If we have to get more space, get enough to last a while. */
nbytes_added += 2000;
- /* Don't allow a buffer size that won't fit in an int
- even if it will fit in a Lisp integer.
- That won't work because so many places use `int'.
-
- Make sure we don't introduce overflows in the calculation. */
-
- if (Z_BYTE - BEG_BYTE + GAP_SIZE
- >= (((EMACS_INT) 1 << (min (VALBITS, BITS_PER_INT) - 1)) - 1
- - nbytes_added))
- error ("Buffer exceeds maximum size");
+ { EMACS_INT total_size = Z_BYTE - BEG_BYTE + GAP_SIZE + nbytes_added;
+ if (total_size < 0
+ /* Don't allow a buffer size that won't fit in a Lisp integer. */
+ || total_size != XINT (make_number (total_size))
+ /* Don't allow a buffer size that won't fit in an int
+ even if it will fit in a Lisp integer.
+ That won't work because so many places still use `int'. */
+ || total_size != (EMACS_INT) (int) total_size)
+ error ("Buffer exceeds maximum size");
+ }
enlarge_buffer_text (current_buffer, nbytes_added);