aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2011-06-19 22:51:47 -0700
committerPaul Eggert2011-06-19 22:51:47 -0700
commitccd6111c2415fc357944464cdf51ab496364241c (patch)
tree0f98d8b17e39b90a09bb005a539464fe00f165f3 /src
parentb5b8c9e5d3c14ad3510af9edb2d693f312eecf53 (diff)
downloademacs-ccd6111c2415fc357944464cdf51ab496364241c.tar.gz
emacs-ccd6111c2415fc357944464cdf51ab496364241c.zip
* font.c (font_intern_prop): Don't assume string length fits in int.
Don't assume integer property fits in fixnum. * font.h (font_intern_prop): 2nd arg is now ptrdiff_t, not int.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog3
-rw-r--r--src/font.c11
-rw-r--r--src/font.h3
3 files changed, 13 insertions, 4 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 32756b4427f..cb6ea8ff9eb 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -3,6 +3,9 @@
3 * font.c: Don't assume string length fits in int. 3 * font.c: Don't assume string length fits in int.
4 (font_parse_xlfd, font_parse_fcname, font_unparse_fcname): 4 (font_parse_xlfd, font_parse_fcname, font_unparse_fcname):
5 Use ptrdiff_t, not int. 5 Use ptrdiff_t, not int.
6 (font_intern_prop): Don't assume string length fits in int.
7 Don't assume integer property fits in fixnum.
8 * font.h (font_intern_prop): 2nd arg is now ptrdiff_t, not int.
6 9
7 * filelock.c: Fix some buffer overrun and integer overflow issues. 10 * filelock.c: Fix some buffer overrun and integer overflow issues.
8 (get_boot_time): Don't assume that gzip command string fits in 100 bytes. 11 (get_boot_time): Don't assume that gzip command string fits in 100 bytes.
diff --git a/src/font.c b/src/font.c
index b9cdde376a5..cc57af12141 100644
--- a/src/font.c
+++ b/src/font.c
@@ -232,9 +232,9 @@ static int num_font_drivers;
232 STR. */ 232 STR. */
233 233
234Lisp_Object 234Lisp_Object
235font_intern_prop (const char *str, int len, int force_symbol) 235font_intern_prop (const char *str, ptrdiff_t len, int force_symbol)
236{ 236{
237 int i; 237 ptrdiff_t i;
238 Lisp_Object tem; 238 Lisp_Object tem;
239 Lisp_Object obarray; 239 Lisp_Object obarray;
240 EMACS_INT nbytes, nchars; 240 EMACS_INT nbytes, nchars;
@@ -247,7 +247,12 @@ font_intern_prop (const char *str, int len, int force_symbol)
247 if (! isdigit (str[i])) 247 if (! isdigit (str[i]))
248 break; 248 break;
249 if (i == len) 249 if (i == len)
250 return make_number (atoi (str)); 250 {
251 Lisp_Object num = string_to_number (str, 10, 0);
252 if (! INTEGERP (num))
253 xsignal1 (Qoverflow_error, num);
254 return num;
255 }
251 } 256 }
252 257
253 /* The following code is copied from the function intern (in 258 /* The following code is copied from the function intern (in
diff --git a/src/font.h b/src/font.h
index 0ca9e8baec4..e50eaff9a1f 100644
--- a/src/font.h
+++ b/src/font.h
@@ -777,7 +777,8 @@ extern void font_done_for_face (FRAME_PTR f, struct face *face);
777extern Lisp_Object font_open_by_spec (FRAME_PTR f, Lisp_Object spec); 777extern Lisp_Object font_open_by_spec (FRAME_PTR f, Lisp_Object spec);
778extern Lisp_Object font_open_by_name (FRAME_PTR f, const char *name); 778extern Lisp_Object font_open_by_name (FRAME_PTR f, const char *name);
779 779
780extern Lisp_Object font_intern_prop (const char *str, int len, int force_symbol); 780extern Lisp_Object font_intern_prop (const char *str, ptrdiff_t len,
781 int force_symbol);
781extern void font_update_sort_order (int *order); 782extern void font_update_sort_order (int *order);
782 783
783extern void font_parse_family_registry (Lisp_Object family, 784extern void font_parse_family_registry (Lisp_Object family,