summaryrefslogtreecommitdiff
path: root/src/process.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2019-06-27 12:31:27 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2019-06-27 12:35:08 -0700
commit4893a09c005cac81c05cd3db05c87225be6a7b42 (patch)
tree1e1e193f61c97067076a1b2f0940c79d5e92ed33 /src/process.c
parent3502d4c1b587057c2f5907997f74ae0a2e0d2a7d (diff)
downloademacs-4893a09c005cac81c05cd3db05c87225be6a7b42.tar.gz
Clean up use of XFIXNUM etc.
A few bits of the code were relying on the fact that XFIXNUM, XFIXNAT, and XUFIXNUM do something even with arguments that are not fixnums/fixnats. Separate these rare uses out into XFIXNUM_RAW and XUFIXNUM_RAW. Problem and original patch reported by Pip Cet (Bug#36370). * src/ccl.c (Fccl_execute_on_string): * src/fileio.c (Finsert_file_contents, a_write) (Fdo_auto_save): * src/process.c (conv_lisp_to_sockaddr): * src/textprop.c (Fnext_single_char_property_change) (Fprevious_single_char_property_change) (Fnext_property_change, Fnext_single_property_change) (Fprevious_property_change) (Fprevious_single_property_change): Don’t assume fixnums are nonnegative. * src/ccl.c (Fccl_execute_on_string): Fix range-checking bug if AREF (status, i) is out of int range. * src/data.c (arith_driver): Use XFIXNUM_RAW as we want efficient garbage if the value is not a fixnum. * src/dosfns.c (Fint86, Fdos_memput): Check that args are nonnegative. * src/image.c (lookup_image): Check that args are in range. * src/lisp.h (lisp_h_XHASH): Use XUFIXNUM_RAW, since this is for hashing. (lisp_h_XFIXNAT, XFIXNAT) [USE_LSB_TAG]: Remove macros. (lisp_h_XFIXNUM_RAW, XFIXNUM_RAW) [USE_LSB_TAG]: New macros, with the semantics of the old macros without _RAW. (XFIXNUM_RAW, XUFIXNUM_RAW): New inline functions, with the semantics of the old functions without _RAW. (FIXNUMP): Move definition up to avoid forward use. (XFIXNUM, XFIXNAT, XUFIXNUM): Use eassume to add a runtime check (when debugging) that the argument has the proper form. (XFIXNUM, XFIXNAT): Now inline functions only, since they refer to their arguments more than once now that they use eassume. * src/textprop.c (Fprevious_single_char_property_change): Avoid fixnum overflow with invalid input. (set_text_properties): Fix unlikely failure to validate arguments, by using EQ instead of XFIXNAT. * src/w32term.c (w32_draw_glyph_string): * src/xterm.c (x_draw_glyph_string): Treat negative minimums as 0 rather than as garbage patterns.
Diffstat (limited to 'src/process.c')
-rw-r--r--src/process.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/process.c b/src/process.c
index 15d87cf6015..cab390c10c6 100644
--- a/src/process.c
+++ b/src/process.c
@@ -2675,7 +2675,7 @@ conv_lisp_to_sockaddr (int family, Lisp_Object address, struct sockaddr *sa, int
for (i = 0; i < len; i++)
if (FIXNUMP (p->contents[i]))
{
- int j = XFIXNAT (p->contents[i]) & 0xffff;
+ int j = XFIXNUM (p->contents[i]) & 0xffff;
ip6[i] = ntohs (j);
}
sa->sa_family = family;