diff options
author | Eli Zaretskii <eliz@gnu.org> | 2011-04-29 22:47:29 +0300 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2011-04-29 22:47:29 +0300 |
commit | 15cbd324fd48e47abd57b8d92c3406c866169d21 (patch) | |
tree | aa05b809dcec4391837ac2f4a41d1b8fdc93cbc2 /src/fileio.c | |
parent | ae940ccad19a554e1134b7ae443716e46c72366d (diff) | |
download | emacs-15cbd324fd48e47abd57b8d92c3406c866169d21.tar.gz |
Lift the MOST_POSITIVE_FIXNUM/4 limitation on visited files (bug#8528).
src/fileio.c (Finsert_file_contents): Don't limit file size to 1/4
of MOST_POSITIVE_FIXNUM.
src/coding.c (coding_alloc_by_realloc): Error out if destination
will grow beyond MOST_POSITIVE_FIXNUM.
(decode_coding_emacs_mule): Abort if there isn't enough place in
charbuf for the composition carryover bytes. Reserve an extra
space for up to 2 characters produced in a loop.
(decode_coding_iso_2022): Abort if there isn't enough place in
charbuf for the composition carryover bytes.
Diffstat (limited to 'src/fileio.c')
-rw-r--r-- | src/fileio.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/fileio.c b/src/fileio.c index dcba6b6c0ae..7e6fd8c82a8 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -3245,15 +3245,10 @@ variable `last-coding-system-used' to the coding system actually used. */) record_unwind_protect (close_file_unwind, make_number (fd)); - /* Arithmetic overflow can occur if an Emacs integer cannot represent the - file size, or if the calculations below overflow. The calculations below - double the file size twice, so check that it can be multiplied by 4 - safely. - - Also check whether the size is negative, which can happen on a platform - that allows file sizes greater than the maximum off_t value. */ + /* Check whether the size is too large or negative, which can happen on a + platform that allows file sizes greater than the maximum off_t value. */ if (! not_regular - && ! (0 <= st.st_size && st.st_size <= MOST_POSITIVE_FIXNUM / 4)) + && ! (0 <= st.st_size && st.st_size <= MOST_POSITIVE_FIXNUM)) error ("Maximum buffer size exceeded"); /* Prevent redisplay optimizations. */ |