diff options
| author | Paul Eggert | 2011-07-28 18:50:56 -0700 |
|---|---|---|
| committer | Paul Eggert | 2011-07-28 18:50:56 -0700 |
| commit | a5a5cbd4e3e55e5dd2afc6826f572c8520350855 (patch) | |
| tree | b7e98219aea651273a8c6d025d38921e73ba9142 /src | |
| parent | 8fbadbe3d240897b2fb265e749cfc9bdeb4bac39 (diff) | |
| download | emacs-a5a5cbd4e3e55e5dd2afc6826f572c8520350855.tar.gz emacs-a5a5cbd4e3e55e5dd2afc6826f572c8520350855.zip | |
* xdisp.c: Integer and memory overflow fixes.
(store_mode_line_noprop_char, x_consider_frame_title):
Use ptrdiff_t, not int, for sizes.
(store_mode_line_noprop_char): Don't update size until alloc done.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 5 | ||||
| -rw-r--r-- | src/xdisp.c | 12 |
2 files changed, 13 insertions, 4 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 144ec31c518..a7bc6bdd461 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,10 @@ | |||
| 1 | 2011-07-29 Paul Eggert <eggert@cs.ucla.edu> | 1 | 2011-07-29 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 2 | ||
| 3 | * xdisp.c: Integer and memory overflow fixes. | ||
| 4 | (store_mode_line_noprop_char, x_consider_frame_title): | ||
| 5 | Use ptrdiff_t, not int, for sizes. | ||
| 6 | (store_mode_line_noprop_char): Don't update size until alloc done. | ||
| 7 | |||
| 3 | * tparam.c: Integer and memory overflow fixes. | 8 | * tparam.c: Integer and memory overflow fixes. |
| 4 | (tparam1): Use ptrdiff_t, not int, for sizes. | 9 | (tparam1): Use ptrdiff_t, not int, for sizes. |
| 5 | Don't update size until alloc done. | 10 | Don't update size until alloc done. |
diff --git a/src/xdisp.c b/src/xdisp.c index 55296db0b8f..92a7b200846 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -10252,8 +10252,12 @@ store_mode_line_noprop_char (char c) | |||
| 10252 | double the buffer's size. */ | 10252 | double the buffer's size. */ |
| 10253 | if (mode_line_noprop_ptr == mode_line_noprop_buf_end) | 10253 | if (mode_line_noprop_ptr == mode_line_noprop_buf_end) |
| 10254 | { | 10254 | { |
| 10255 | int len = MODE_LINE_NOPROP_LEN (0); | 10255 | ptrdiff_t len = MODE_LINE_NOPROP_LEN (0); |
| 10256 | int new_size = 2 * len * sizeof *mode_line_noprop_buf; | 10256 | ptrdiff_t new_size; |
| 10257 | |||
| 10258 | if (STRING_BYTES_BOUND / 2 < len) | ||
| 10259 | memory_full (SIZE_MAX); | ||
| 10260 | new_size = 2 * len; | ||
| 10257 | mode_line_noprop_buf = (char *) xrealloc (mode_line_noprop_buf, new_size); | 10261 | mode_line_noprop_buf = (char *) xrealloc (mode_line_noprop_buf, new_size); |
| 10258 | mode_line_noprop_buf_end = mode_line_noprop_buf + new_size; | 10262 | mode_line_noprop_buf_end = mode_line_noprop_buf + new_size; |
| 10259 | mode_line_noprop_ptr = mode_line_noprop_buf + len; | 10263 | mode_line_noprop_ptr = mode_line_noprop_buf + len; |
| @@ -10317,9 +10321,9 @@ x_consider_frame_title (Lisp_Object frame) | |||
| 10317 | /* Do we have more than one visible frame on this X display? */ | 10321 | /* Do we have more than one visible frame on this X display? */ |
| 10318 | Lisp_Object tail; | 10322 | Lisp_Object tail; |
| 10319 | Lisp_Object fmt; | 10323 | Lisp_Object fmt; |
| 10320 | int title_start; | 10324 | ptrdiff_t title_start; |
| 10321 | char *title; | 10325 | char *title; |
| 10322 | int len; | 10326 | ptrdiff_t len; |
| 10323 | struct it it; | 10327 | struct it it; |
| 10324 | int count = SPECPDL_INDEX (); | 10328 | int count = SPECPDL_INDEX (); |
| 10325 | 10329 | ||