]> 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:17:22 +0000 (10:17 +0000)
committerEli Zaretskii <eliz@gnu.org>
Sat, 3 May 2008 10:17:22 +0000 (10:17 +0000)
src/ChangeLog
src/dired.c

index e84316ac91f0d23770acfce1ca9e22a8424f7f2d..a6596173ab4c1149099a33c90076952c682b1dde 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  Daiki Ueno  <ueno@unixuser.org>
 
        * Makefile.in (lisp, shortlisp): Add epa-file-hook.elc.
index e11c37ca5b7f8c3ad5d0895a14798c1d28e574da..d3a6e7b7ceca4fb99b5a6568df06278c62dec293 100644 (file)
@@ -1048,8 +1048,11 @@ Elements of the attribute list are:
                                 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