• Paul Eggert's avatar
    Improve buffer-overflow checking. · 1c8e352f
    Paul Eggert authored
    * fileio.c (Finsert_file_contents):
    * insdel.c (insert_from_buffer_1, replace_range, replace_range_2):
    Remove the old (too-loose) buffer overflow checks.
    They weren't needed, since make_gap checks for buffer overflow.
    * insdel.c (make_gap_larger): Catch buffer overflows that were missed.
    The old code merely checked for Emacs fixnum overflow, and relied
    on undefined (wraparound) behavior.  The new code avoids undefined
    behavior, and also checks for ptrdiff_t and/or size_t overflow.
fileio.c 175 KB