]> git.eshelyaron.com Git - emacs.git/commitdiff
(Ffile_attributes): Don't allow the device number become negative.
authorEli Zaretskii <eliz@gnu.org>
Sat, 3 May 2008 10:11:22 +0000 (10:11 +0000)
committerEli Zaretskii <eliz@gnu.org>
Sat, 3 May 2008 10:11:22 +0000 (10:11 +0000)
src/ChangeLog
src/dired.c

index 0849e9ee4b750f93355d76a7463a0058c655e1e7..8efef814555cb1d2afa60275b20b3ff3ced87747 100644 (file)
@@ -1,3 +1,8 @@
+2008-05-03  Eli Zaretskii  <eliz@gnu.org>
+
+       * dired.c (Ffile_attributes): Don't allow the device number become
+       negative.
+
 2008-05-02  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
 
        * config.in: Regenerate.
index 31b7e19ddae9a80efede43cad4fa0333c0634b02..7936e04a54eb8f963f68b3c202257ab64743a9e7 100644 (file)
@@ -1048,8 +1048,11 @@ Elements of the attribute list are:
     /* 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