diff options
| author | Dmitry Antipov | 2014-09-16 08:07:51 +0400 |
|---|---|---|
| committer | Dmitry Antipov | 2014-09-16 08:07:51 +0400 |
| commit | 005aff709292db4fda0c39e7ed512f064bb7d1a9 (patch) | |
| tree | 505e9f859a7b09d58e9037c8f32824d63e86e1b5 /src | |
| parent | ccb767d639543d70ac689c93eb64849eea376583 (diff) | |
| download | emacs-005aff709292db4fda0c39e7ed512f064bb7d1a9.tar.gz emacs-005aff709292db4fda0c39e7ed512f064bb7d1a9.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 | 6 | ||||
| -rw-r--r-- | src/data.c | 2 | ||||
| -rw-r--r-- | src/fileio.c | 2 | ||||
| -rw-r--r-- | src/font.c | 2 |
4 files changed, 9 insertions, 3 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index fe771fd8f74..915a53f7e6e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -9,6 +9,12 @@ | |||
| 9 | (apply_lambda): Likewise. Get current specpdl level as 3rd arg. | 9 | (apply_lambda): Likewise. Get current specpdl level as 3rd arg. |
| 10 | (do_debug_on_call): Get current specpdl level as 2nd arg. | 10 | (do_debug_on_call): Get current specpdl level as 2nd arg. |
| 11 | 11 | ||
| 12 | Prefer ptrdiff_t to int and avoid integer overflows. | ||
| 13 | * fileio.c (make_temp_name): | ||
| 14 | * font.c (font_parse_family_registry): Avoid integer | ||
| 15 | overflow on string size calculation. | ||
| 16 | * data.c (Faset): Likewise for byte index. | ||
| 17 | |||
| 12 | 2014-09-15 Eli Zaretskii <eliz@gnu.org> | 18 | 2014-09-15 Eli Zaretskii <eliz@gnu.org> |
| 13 | 19 | ||
| 14 | Fix display of R2L lines in partial-width windows. | 20 | Fix display of R2L lines in partial-width windows. |
diff --git a/src/data.c b/src/data.c index 5aeb24b16dc..f02b4588ad0 100644 --- a/src/data.c +++ b/src/data.c | |||
| @@ -2248,7 +2248,7 @@ bool-vector. IDX starts at 0. */) | |||
| 2248 | { | 2248 | { |
| 2249 | if (! SINGLE_BYTE_CHAR_P (c)) | 2249 | if (! SINGLE_BYTE_CHAR_P (c)) |
| 2250 | { | 2250 | { |
| 2251 | int i; | 2251 | ptrdiff_t i; |
| 2252 | 2252 | ||
| 2253 | for (i = SBYTES (array) - 1; i >= 0; i--) | 2253 | for (i = SBYTES (array) - 1; i >= 0; i--) |
| 2254 | if (SREF (array, i) >= 0x80) | 2254 | if (SREF (array, i) >= 0x80) |
diff --git a/src/fileio.c b/src/fileio.c index 261928dd821..b4653017b28 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -733,7 +733,7 @@ Lisp_Object | |||
| 733 | make_temp_name (Lisp_Object prefix, bool base64_p) | 733 | make_temp_name (Lisp_Object prefix, bool base64_p) |
| 734 | { | 734 | { |
| 735 | Lisp_Object val, encoded_prefix; | 735 | Lisp_Object val, encoded_prefix; |
| 736 | int len; | 736 | ptrdiff_t len; |
| 737 | printmax_t pid; | 737 | printmax_t pid; |
| 738 | char *p, *data; | 738 | char *p, *data; |
| 739 | char pidbuf[INT_BUFSIZE_BOUND (printmax_t)]; | 739 | char pidbuf[INT_BUFSIZE_BOUND (printmax_t)]; |
diff --git a/src/font.c b/src/font.c index afa138003f2..470fa1adc11 100644 --- a/src/font.c +++ b/src/font.c | |||
| @@ -1724,7 +1724,7 @@ font_parse_name (char *name, ptrdiff_t namelen, Lisp_Object font) | |||
| 1724 | void | 1724 | void |
| 1725 | font_parse_family_registry (Lisp_Object family, Lisp_Object registry, Lisp_Object font_spec) | 1725 | font_parse_family_registry (Lisp_Object family, Lisp_Object registry, Lisp_Object font_spec) |
| 1726 | { | 1726 | { |
| 1727 | int len; | 1727 | ptrdiff_t len; |
| 1728 | char *p0, *p1; | 1728 | char *p0, *p1; |
| 1729 | 1729 | ||
| 1730 | if (! NILP (family) | 1730 | if (! NILP (family) |