]> code.delx.au - gnu-emacs/blobdiff - src/fileio.c
Merge from emacs--devo--0
[gnu-emacs] / src / fileio.c
index 51a40e66db9b5a1b75262884beae578c0d102952..4dfb0d24796048f91dc6d6d68a4574286f7f6fe8 100644 (file)
@@ -21,6 +21,7 @@ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 Boston, MA 02110-1301, USA.  */
 
 #include <config.h>
+#include <limits.h>
 
 #ifdef HAVE_FCNTL_H
 #include <fcntl.h>
@@ -3882,7 +3883,7 @@ variable `last-coding-system-used' to the coding system actually used.  */)
             overflow.  The calculations below double the file size
             twice, so check that it can be multiplied by 4 safely.  */
          if (XINT (end) != st.st_size
-             || ((int) st.st_size * 4) / 4 != st.st_size)
+             || st.st_size > INT_MAX / 4)
            error ("Maximum buffer size exceeded");
 
          /* The file size returned from stat may be zero, but data