• Paul Eggert's avatar
    Clean up use of XFIXNUM etc. · 4893a09c
    Paul Eggert authored
    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.
    4893a09c
lisp.h 159 KB