changeset 94577:511a75ebd7df

(Ffile_attributes): Don't allow the device number become negative.
author Eli Zaretskii <eliz@gnu.org>
date Sat, 03 May 2008 10:16:35 +0000
parents 7de38dedf0a6
children 7bfee6b6aa8d
files src/dired.c
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/dired.c	Sat May 03 09:45:20 2008 +0000
+++ b/src/dired.c	Sat May 03 10:16:35 2008 +0000
@@ -1048,8 +1048,11 @@
 				 make_number (low_ino & 0xffff)));
     }
 
-  /* Likewise for device.  */
-  if (FIXNUM_OVERFLOW_P (s.st_dev))
+  /* Likewise for device, but don't let it become negative.  We used
+     to use FIXNUM_OVERFLOW_P here, but that won't catch large
+     positive numbers such as 0xFFEEDDCC.  */
+  if ((EMACS_INT)s.st_dev < 0
+      || (EMACS_INT)s.st_dev > MOST_POSITIVE_FIXNUM)
     values[11] = Fcons (make_number (s.st_dev >> 16),
 			make_number (s.st_dev & 0xffff));
   else