From 7412d4290304cd6debddc704fa4a758687587d4c Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 3 May 2008 10:17:22 +0000 Subject: [PATCH] (Ffile_attributes): Don't allow the device number become negative. --- src/ChangeLog | 5 +++++ src/dired.c | 7 +++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index e84316ac91f..a6596173ab4 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2008-05-03 Eli Zaretskii + + * dired.c (Ffile_attributes): Don't allow the device number become + negative. + 2008-05-02 Daiki Ueno * Makefile.in (lisp, shortlisp): Add epa-file-hook.elc. diff --git a/src/dired.c b/src/dired.c index e11c37ca5b7..d3a6e7b7cec 100644 --- a/src/dired.c +++ b/src/dired.c @@ -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 -- 2.39.5