]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
misc/sys/select.h (__FD_MASK): Avoid signed integer overflow.
authorFlorian Weimer <fweimer@redhat.com>
Tue, 25 Feb 2014 13:56:10 +0000 (14:56 +0100)
committerFlorian Weimer <fweimer@redhat.com>
Tue, 25 Feb 2014 13:56:10 +0000 (14:56 +0100)
Shifting into the sign position is currently supported as a GCC
extension, but explicitly subjected to future changes.  Computation
in the unsigned type followed by a cast to the signed type is a GCC
extension that will be available forever.

ChangeLog
NEWS
misc/sys/select.h

index caa89170d73a62ac4f13d19d0ef47dcae70deb87..0071571bceb3a26f4a606fba0ae060cc51988ea7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2014-02-25  Florian Weimer  <fweimer@redhat.com>
+
+       [BZ #15347]
+       * misc/sys/select.h (__FD_MASK): Avoid signed integer overflow.
+
 2014-02-25  Will Newton  <will.newton@linaro.org>
 
        * sysdeps/arm/__longjmp.S: Include stap-probe.h.
diff --git a/NEWS b/NEWS
index 3698c404f0cf95418e1fe5526ed27a11e19f435f..96966d75533d42f3943223d553ef284ec3ed97e3 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -9,7 +9,7 @@ Version 2.20
 
 * The following bugs are resolved with this release:
 
-  15804, 15894, 16447, 16545, 16574, 16600, 16609, 16610, 16611.
+  15347, 15804, 15894, 16447, 16545, 16574, 16600, 16609, 16610, 16611.
 
 * The am33 port, which had not worked for several years, has been removed
   from ports.
index fd13bab41a488911ae95c2919a74587f8c3525b8..941588d9c40d39b7e917fcaddc9d9b93617b8a73 100644 (file)
@@ -58,7 +58,7 @@ typedef long int __fd_mask;
 /* It's easier to assume 8-bit bytes than to get CHAR_BIT.  */
 #define __NFDBITS      (8 * (int) sizeof (__fd_mask))
 #define        __FD_ELT(d)     ((d) / __NFDBITS)
-#define        __FD_MASK(d)    ((__fd_mask) 1 << ((d) % __NFDBITS))
+#define        __FD_MASK(d)    ((__fd_mask) (1UL << ((d) % __NFDBITS)))
 
 /* fd_set for select and pselect.  */
 typedef struct