changeset 80551:11d4beac3bb0

(Ffile_attributes): Don't allow the device number become negative.
author Eli Zaretskii <eliz@gnu.org>
date Sat, 03 May 2008 10:09:10 +0000
parents c147a137d94d
children 0fd2c3648c4e
files src/dired.c
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/dired.c	Fri May 02 09:40:19 2008 +0000
+++ b/src/dired.c	Sat May 03 10:09:10 2008 +0000
@@ -1048,8 +1048,11 @@
     /* But keep the most common cases as integers.  */
     values[10] = make_number (ino);
 
-  /* 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