]> git.eshelyaron.com Git - emacs.git/commitdiff
Prefer ptrdiff_t to int and avoid integer overflows.
authorDmitry Antipov <dmantipov@yandex.ru>
Sat, 13 Sep 2014 04:41:54 +0000 (08:41 +0400)
committerDmitry Antipov <dmantipov@yandex.ru>
Sat, 13 Sep 2014 04:41:54 +0000 (08:41 +0400)
* fileio.c (make_temp_name):
* font.c (font_parse_family_registry): Avoid integer
overflow on string size calculation.
* data.c (Faset): Likewise for byte index.

src/ChangeLog
src/data.c
src/fileio.c
src/font.c

index 7b40f87348aa2ff070bf05f349df79f249dd1ac6..cb3aa8c7fe33c0a3185b848ad6aa93ac754a5028 100644 (file)
@@ -1,3 +1,11 @@
+2014-09-13  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       Prefer ptrdiff_t to int and avoid integer overflows.
+       * fileio.c (make_temp_name):
+       * font.c (font_parse_family_registry): Avoid integer
+       overflow on string size calculation.
+       * data.c (Faset): Likewise for byte index.
+
 2014-09-12  Detlev Zundel  <dzu@member.fsf.org>
 
        * buffer.c (syms_of_buffer): DEFSYM Qchoice (Bug#18337).
@@ -15,7 +23,7 @@
        * lread.c (readevalloop_eager_expand_eval): Add GCPRO and fix
        bootstrap broken if GC_MARK_STACK == GC_USE_GCPROS_AS_BEFORE.
 
-       Remove redundant GCPROs around Ffuncall and Fapply calls. This
+       Remove redundant GCPROs around Ffuncall and Fapply calls.  This
        is safe because Ffuncall protects all of its arguments by itself.
        * charset.c (map_charset_for_dump): Remove redundant GCPRO.
        * eval.c (Fapply, apply1, call0, call1, call2, call3, call4, call5)
index fd515af5003acb510cf0a16d68a1eb20102f5dfc..5b8e01e29502074a2bdfebaad8281c564e7fda4c 100644 (file)
@@ -2310,7 +2310,7 @@ bool-vector.  IDX starts at 0.  */)
        {
          if (! SINGLE_BYTE_CHAR_P (c))
            {
-             int i;
+             ptrdiff_t i;
 
              for (i = SBYTES (array) - 1; i >= 0; i--)
                if (SREF (array, i) >= 0x80)
index f98cdc5d3e43b14f415127a44859b929b30e804a..0626bd3653a521cb9fbf5202c0737638cb5e9969 100644 (file)
@@ -728,7 +728,7 @@ Lisp_Object
 make_temp_name (Lisp_Object prefix, bool base64_p)
 {
   Lisp_Object val, encoded_prefix;
-  int len;
+  ptrdiff_t len;
   printmax_t pid;
   char *p, *data;
   char pidbuf[INT_BUFSIZE_BOUND (printmax_t)];
index 46fc51bd5ad19e923d48ffeb81832b7677424f65..412cd3f938d98588f24ea0bf93cb0b4a51467b82 100644 (file)
@@ -1761,7 +1761,7 @@ font_parse_name (char *name, ptrdiff_t namelen, Lisp_Object font)
 void
 font_parse_family_registry (Lisp_Object family, Lisp_Object registry, Lisp_Object font_spec)
 {
-  int len;
+  ptrdiff_t len;
   char *p0, *p1;
 
   if (! NILP (family)