Commit ccd6111c authored by Paul Eggert's avatar Paul Eggert

* 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.
parent b5b8c9e5
......@@ -3,6 +3,9 @@
* font.c: Don't assume string length fits in int.
(font_parse_xlfd, font_parse_fcname, font_unparse_fcname):
Use ptrdiff_t, not int.
(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.
* filelock.c: Fix some buffer overrun and integer overflow issues.
(get_boot_time): Don't assume that gzip command string fits in 100 bytes.
......
......@@ -232,9 +232,9 @@ static int num_font_drivers;
STR. */
Lisp_Object
font_intern_prop (const char *str, int len, int force_symbol)
font_intern_prop (const char *str, ptrdiff_t len, int force_symbol)
{
int i;
ptrdiff_t i;
Lisp_Object tem;
Lisp_Object obarray;
EMACS_INT nbytes, nchars;
......@@ -247,7 +247,12 @@ font_intern_prop (const char *str, int len, int force_symbol)
if (! isdigit (str[i]))
break;
if (i == len)
return make_number (atoi (str));
{
Lisp_Object num = string_to_number (str, 10, 0);
if (! INTEGERP (num))
xsignal1 (Qoverflow_error, num);
return num;
}
}
/* The following code is copied from the function intern (in
......
......@@ -777,7 +777,8 @@ extern void font_done_for_face (FRAME_PTR f, struct face *face);
extern Lisp_Object font_open_by_spec (FRAME_PTR f, Lisp_Object spec);
extern Lisp_Object font_open_by_name (FRAME_PTR f, const char *name);
extern Lisp_Object font_intern_prop (const char *str, int len, int force_symbol);
extern Lisp_Object font_intern_prop (const char *str, ptrdiff_t len,
int force_symbol);
extern void font_update_sort_order (int *order);
extern void font_parse_family_registry (Lisp_Object family,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment