summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDmitry Antipov <dmantipov@yandex.ru>2014-09-16 15:43:49 +0400
committerDmitry Antipov <dmantipov@yandex.ru>2014-09-16 15:43:49 +0400
commit3e67a981c4f45cf960a93e31010253b33bcdbaf5 (patch)
treebbae14abf04e5443af7644b89ed5c60d69971af1 /src
parentb98b1a831bcfc89f038cbb8048c6969d8c73ab28 (diff)
downloademacs-3e67a981c4f45cf960a93e31010253b33bcdbaf5.tar.gz
Avoid more integer overflows on string size calculations.
* category.c (Fmake_category_set): * xdisp.c (get_overlay_arrow_glyph_row): * w32font.c (intern_font_name): Prefer ptrdiff_t to int.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog5
-rw-r--r--src/category.c2
-rw-r--r--src/w32font.c2
-rw-r--r--src/xdisp.c2
4 files changed, 8 insertions, 3 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index a920ac1b970..2d5de9be5d8 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -16,6 +16,11 @@
(x_clipboard_manager_save_all):
* xterm.c (x_term_init): Use build_local_string.
+ Avoid more integer overflows on string size calculations.
+ * category.c (Fmake_category_set):
+ * xdisp.c (get_overlay_arrow_glyph_row):
+ * w32font.c (intern_font_name): Prefer ptrdiff_t to int.
+
2014-09-15 Eli Zaretskii <eliz@gnu.org>
* sound.c [WINDOWSNT]: Include w32common.h and mbstring.h.
diff --git a/src/category.c b/src/category.c
index 851ae1a4c24..a4610e4d358 100644
--- a/src/category.c
+++ b/src/category.c
@@ -96,7 +96,7 @@ those categories. */)
(Lisp_Object categories)
{
Lisp_Object val;
- int len;
+ ptrdiff_t len;
CHECK_STRING (categories);
val = MAKE_CATEGORY_SET;
diff --git a/src/w32font.c b/src/w32font.c
index de0732dd4da..24666ad97c7 100644
--- a/src/w32font.c
+++ b/src/w32font.c
@@ -287,7 +287,7 @@ Lisp_Object
intern_font_name (char * string)
{
Lisp_Object str = DECODE_SYSTEM (build_string (string));
- int len = SCHARS (str);
+ ptrdiff_t len = SCHARS (str);
Lisp_Object obarray = check_obarray (Vobarray);
Lisp_Object tem = oblookup (obarray, SDATA (str), len, len);
/* This code is similar to intern function from lread.c. */
diff --git a/src/xdisp.c b/src/xdisp.c
index b697b803049..3a895164fe2 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -18858,7 +18858,7 @@ get_overlay_arrow_glyph_row (struct window *w, Lisp_Object overlay_arrow_string)
struct buffer *buffer = XBUFFER (w->contents);
struct buffer *old = current_buffer;
const unsigned char *arrow_string = SDATA (overlay_arrow_string);
- int arrow_len = SCHARS (overlay_arrow_string);
+ ptrdiff_t arrow_len = SCHARS (overlay_arrow_string);
const unsigned char *arrow_end = arrow_string + arrow_len;
const unsigned char *p;
struct it it;