diff src/fileio.c @ 91302:56a72e2bd635

Merge from emacs--devo--0 Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-306
author Miles Bader <miles@gnu.org>
date Sat, 29 Dec 2007 02:39:17 +0000
parents 2a54f2cb1b4b d40e3ce78801
children 606f2d163a64
line wrap: on
line diff
--- a/src/fileio.c	Fri Dec 28 02:13:20 2007 +0000
+++ b/src/fileio.c	Sat Dec 29 02:39:17 2007 +0000
@@ -21,6 +21,7 @@
 Boston, MA 02110-1301, USA.  */
 
 #include <config.h>
+#include <limits.h>
 
 #ifdef HAVE_FCNTL_H
 #include <fcntl.h>
@@ -3882,7 +3883,7 @@
 	     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