aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2011-06-19 20:21:35 -0700
committerPaul Eggert2011-06-19 20:21:35 -0700
commitb5b8c9e5d3c14ad3510af9edb2d693f312eecf53 (patch)
tree60826fc85c6a8a8de0c80d2f8baee4e2d22dec1b /src
parent882f0d8119c9135b06ce9b291a139e4e9c6eeff8 (diff)
downloademacs-b5b8c9e5d3c14ad3510af9edb2d693f312eecf53.tar.gz
emacs-b5b8c9e5d3c14ad3510af9edb2d693f312eecf53.zip
* font.c: Don't assume string length fits in int.
(font_parse_xlfd, font_parse_fcname, font_unparse_fcname): Use ptrdiff_t, not int.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog4
-rw-r--r--src/font.c11
2 files changed, 10 insertions, 5 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index fd17f85f1e1..32756b4427f 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,9 @@
12011-06-20 Paul Eggert <eggert@cs.ucla.edu> 12011-06-20 Paul Eggert <eggert@cs.ucla.edu>
2 2
3 * font.c: Don't assume string length fits in int.
4 (font_parse_xlfd, font_parse_fcname, font_unparse_fcname):
5 Use ptrdiff_t, not int.
6
3 * filelock.c: Fix some buffer overrun and integer overflow issues. 7 * filelock.c: Fix some buffer overrun and integer overflow issues.
4 (get_boot_time): Don't assume that gzip command string fits in 100 bytes. 8 (get_boot_time): Don't assume that gzip command string fits in 100 bytes.
5 Reformulate so as not to need the command string. 9 Reformulate so as not to need the command string.
diff --git a/src/font.c b/src/font.c
index 4619ed68913..b9cdde376a5 100644
--- a/src/font.c
+++ b/src/font.c
@@ -982,7 +982,7 @@ font_expand_wildcards (Lisp_Object *field, int n)
982int 982int
983font_parse_xlfd (char *name, Lisp_Object font) 983font_parse_xlfd (char *name, Lisp_Object font)
984{ 984{
985 int len = strlen (name); 985 ptrdiff_t len = strlen (name);
986 int i, j, n; 986 int i, j, n;
987 char *f[XLFD_LAST_INDEX + 1]; 987 char *f[XLFD_LAST_INDEX + 1];
988 Lisp_Object val; 988 Lisp_Object val;
@@ -1310,7 +1310,7 @@ font_parse_fcname (char *name, Lisp_Object font)
1310 char *p, *q; 1310 char *p, *q;
1311 char *size_beg = NULL, *size_end = NULL; 1311 char *size_beg = NULL, *size_end = NULL;
1312 char *props_beg = NULL, *family_end = NULL; 1312 char *props_beg = NULL, *family_end = NULL;
1313 int len = strlen (name); 1313 ptrdiff_t len = strlen (name);
1314 1314
1315 if (len == 0) 1315 if (len == 0)
1316 return -1; 1316 return -1;
@@ -1376,7 +1376,7 @@ font_parse_fcname (char *name, Lisp_Object font)
1376 if (*q != '=') 1376 if (*q != '=')
1377 { 1377 {
1378 /* Must be an enumerated value. */ 1378 /* Must be an enumerated value. */
1379 int word_len; 1379 ptrdiff_t word_len;
1380 p = p + 1; 1380 p = p + 1;
1381 word_len = q - p; 1381 word_len = q - p;
1382 val = font_intern_prop (p, q - p, 1); 1382 val = font_intern_prop (p, q - p, 1);
@@ -1452,7 +1452,7 @@ font_parse_fcname (char *name, Lisp_Object font)
1452 Lisp_Object weight = Qnil, slant = Qnil; 1452 Lisp_Object weight = Qnil, slant = Qnil;
1453 Lisp_Object width = Qnil, size = Qnil; 1453 Lisp_Object width = Qnil, size = Qnil;
1454 char *word_start; 1454 char *word_start;
1455 int word_len; 1455 ptrdiff_t word_len;
1456 1456
1457 /* Scan backwards from the end, looking for a size. */ 1457 /* Scan backwards from the end, looking for a size. */
1458 for (p = name + len - 1; p >= name; p--) 1458 for (p = name + len - 1; p >= name; p--)
@@ -1542,7 +1542,8 @@ font_unparse_fcname (Lisp_Object font, int pixel_size, char *name, int nbytes)
1542 Lisp_Object family, foundry; 1542 Lisp_Object family, foundry;
1543 Lisp_Object tail, val; 1543 Lisp_Object tail, val;
1544 int point_size; 1544 int point_size;
1545 int i, len = 1; 1545 int i;
1546 ptrdiff_t len = 1;
1546 char *p; 1547 char *p;
1547 Lisp_Object styles[3]; 1548 Lisp_Object styles[3];
1548 const char *style_names[3] = { "weight", "slant", "width" }; 1549 const char *style_names[3] = { "weight", "slant", "width" };