diff options
| author | Paul Eggert | 2015-04-13 23:26:13 -0700 |
|---|---|---|
| committer | Paul Eggert | 2015-04-13 23:26:59 -0700 |
| commit | b80c5ebc4f6afd54597012583c6a1390db0ade9c (patch) | |
| tree | 96d02d47732d4dd9fd3c16f66db9fd929b4efd41 /src/window.h | |
| parent | e84d1ca3c6a643370c4273ad569b618d8cd72b53 (diff) | |
| download | emacs-b80c5ebc4f6afd54597012583c6a1390db0ade9c.tar.gz emacs-b80c5ebc4f6afd54597012583c6a1390db0ade9c.zip | |
Avoid some int overflows in window.c
* src/print.c (print_object):
* src/window.c (sequence_number):
* src/window.h (struct window.sequence_number):
Don't assume window sequence number fits in int.
* src/window.c (window_select_count):
* src/window.h (struct window.use_time, window_select_count):
Don't assume window use time fits in int.
* src/window.c (Fsplit_window_internal):
Don't assume user-supplied integer, or sum, fits in int.
(Fset_window_configuration, count_windows, get_leaf_windows)
(save_window_save, Fcurrent_window_configuration):
Use ptrdiff_t for object counts.
(Fset_window_configuration): Omit unused local 'n'.
(count_windows): Simplify by writing in terms of get_leaf_windows.
(get_leaf_windows): Don't store through FLAT if it's null.
(extract_dimension): New static function.
(set_window_margins, set_window_fringes, set_window_scroll_bars):
Use it to avoid undefined behavior when converting user-supplied
integer to 'int'.
Diffstat (limited to 'src/window.h')
| -rw-r--r-- | src/window.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/window.h b/src/window.h index 96e7438f46e..eaff57eaedf 100644 --- a/src/window.h +++ b/src/window.h | |||
| @@ -195,10 +195,10 @@ struct window | |||
| 195 | Lisp_Object next_buffers; | 195 | Lisp_Object next_buffers; |
| 196 | 196 | ||
| 197 | /* Number saying how recently window was selected. */ | 197 | /* Number saying how recently window was selected. */ |
| 198 | int use_time; | 198 | EMACS_INT use_time; |
| 199 | 199 | ||
| 200 | /* Unique number of window assigned when it was created. */ | 200 | /* Unique number of window assigned when it was created. */ |
| 201 | int sequence_number; | 201 | EMACS_INT sequence_number; |
| 202 | 202 | ||
| 203 | /* The upper left corner pixel coordinates of this window, as | 203 | /* The upper left corner pixel coordinates of this window, as |
| 204 | integers relative to upper left corner of frame = 0, 0. */ | 204 | integers relative to upper left corner of frame = 0, 0. */ |
| @@ -990,7 +990,7 @@ extern Lisp_Object selected_window; | |||
| 990 | recently used window. Its only users are Fselect_window, | 990 | recently used window. Its only users are Fselect_window, |
| 991 | init_window_once, and make_frame. */ | 991 | init_window_once, and make_frame. */ |
| 992 | 992 | ||
| 993 | extern int window_select_count; | 993 | extern EMACS_INT window_select_count; |
| 994 | 994 | ||
| 995 | /* The minibuffer window of the selected frame. | 995 | /* The minibuffer window of the selected frame. |
| 996 | Note that you cannot test for minibufferness of an arbitrary window | 996 | Note that you cannot test for minibufferness of an arbitrary window |