diff options
| author | Dmitry Antipov | 2014-09-13 08:41:54 +0400 |
|---|---|---|
| committer | Dmitry Antipov | 2014-09-13 08:41:54 +0400 |
| commit | 55998321452ca84a5e6be71c97063d8514cd8668 (patch) | |
| tree | d1cfd555685e4867ec4d3bd0fd62773156912a3c /src | |
| parent | 82bb5d8c5bc9c732fb98e27f27f9aa03664055f1 (diff) | |
| download | emacs-55998321452ca84a5e6be71c97063d8514cd8668.tar.gz emacs-55998321452ca84a5e6be71c97063d8514cd8668.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 10 | ||||
| -rw-r--r-- | src/data.c | 2 | ||||
| -rw-r--r-- | src/fileio.c | 2 | ||||
| -rw-r--r-- | src/font.c | 2 |
4 files changed, 12 insertions, 4 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 7b40f87348a..cb3aa8c7fe3 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2014-09-13 Dmitry Antipov <dmantipov@yandex.ru> | ||
| 2 | |||
| 3 | Prefer ptrdiff_t to int and avoid integer overflows. | ||
| 4 | * fileio.c (make_temp_name): | ||
| 5 | * font.c (font_parse_family_registry): Avoid integer | ||
| 6 | overflow on string size calculation. | ||
| 7 | * data.c (Faset): Likewise for byte index. | ||
| 8 | |||
| 1 | 2014-09-12 Detlev Zundel <dzu@member.fsf.org> | 9 | 2014-09-12 Detlev Zundel <dzu@member.fsf.org> |
| 2 | 10 | ||
| 3 | * buffer.c (syms_of_buffer): DEFSYM Qchoice (Bug#18337). | 11 | * buffer.c (syms_of_buffer): DEFSYM Qchoice (Bug#18337). |
| @@ -15,7 +23,7 @@ | |||
| 15 | * lread.c (readevalloop_eager_expand_eval): Add GCPRO and fix | 23 | * lread.c (readevalloop_eager_expand_eval): Add GCPRO and fix |
| 16 | bootstrap broken if GC_MARK_STACK == GC_USE_GCPROS_AS_BEFORE. | 24 | bootstrap broken if GC_MARK_STACK == GC_USE_GCPROS_AS_BEFORE. |
| 17 | 25 | ||
| 18 | Remove redundant GCPROs around Ffuncall and Fapply calls. This | 26 | Remove redundant GCPROs around Ffuncall and Fapply calls. This |
| 19 | is safe because Ffuncall protects all of its arguments by itself. | 27 | is safe because Ffuncall protects all of its arguments by itself. |
| 20 | * charset.c (map_charset_for_dump): Remove redundant GCPRO. | 28 | * charset.c (map_charset_for_dump): Remove redundant GCPRO. |
| 21 | * eval.c (Fapply, apply1, call0, call1, call2, call3, call4, call5) | 29 | * eval.c (Fapply, apply1, call0, call1, call2, call3, call4, call5) |
diff --git a/src/data.c b/src/data.c index fd515af5003..5b8e01e2950 100644 --- a/src/data.c +++ b/src/data.c | |||
| @@ -2310,7 +2310,7 @@ bool-vector. IDX starts at 0. */) | |||
| 2310 | { | 2310 | { |
| 2311 | if (! SINGLE_BYTE_CHAR_P (c)) | 2311 | if (! SINGLE_BYTE_CHAR_P (c)) |
| 2312 | { | 2312 | { |
| 2313 | int i; | 2313 | ptrdiff_t i; |
| 2314 | 2314 | ||
| 2315 | for (i = SBYTES (array) - 1; i >= 0; i--) | 2315 | for (i = SBYTES (array) - 1; i >= 0; i--) |
| 2316 | if (SREF (array, i) >= 0x80) | 2316 | if (SREF (array, i) >= 0x80) |
diff --git a/src/fileio.c b/src/fileio.c index f98cdc5d3e4..0626bd3653a 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -728,7 +728,7 @@ Lisp_Object | |||
| 728 | make_temp_name (Lisp_Object prefix, bool base64_p) | 728 | make_temp_name (Lisp_Object prefix, bool base64_p) |
| 729 | { | 729 | { |
| 730 | Lisp_Object val, encoded_prefix; | 730 | Lisp_Object val, encoded_prefix; |
| 731 | int len; | 731 | ptrdiff_t len; |
| 732 | printmax_t pid; | 732 | printmax_t pid; |
| 733 | char *p, *data; | 733 | char *p, *data; |
| 734 | char pidbuf[INT_BUFSIZE_BOUND (printmax_t)]; | 734 | char pidbuf[INT_BUFSIZE_BOUND (printmax_t)]; |
diff --git a/src/font.c b/src/font.c index 46fc51bd5ad..412cd3f938d 100644 --- a/src/font.c +++ b/src/font.c | |||
| @@ -1761,7 +1761,7 @@ font_parse_name (char *name, ptrdiff_t namelen, Lisp_Object font) | |||
| 1761 | void | 1761 | void |
| 1762 | font_parse_family_registry (Lisp_Object family, Lisp_Object registry, Lisp_Object font_spec) | 1762 | font_parse_family_registry (Lisp_Object family, Lisp_Object registry, Lisp_Object font_spec) |
| 1763 | { | 1763 | { |
| 1764 | int len; | 1764 | ptrdiff_t len; |
| 1765 | char *p0, *p1; | 1765 | char *p0, *p1; |
| 1766 | 1766 | ||
| 1767 | if (! NILP (family) | 1767 | if (! NILP (family) |