From: Dmitry Antipov Date: Tue, 16 Sep 2014 11:43:49 +0000 (+0400) Subject: Avoid more integer overflows on string size calculations. X-Git-Tag: emacs-25.0.90~2635^2~679^2~282 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=3e67a981c4f45cf960a93e31010253b33bcdbaf5;p=emacs.git 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. --- 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 * 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;