From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Daniel Micay <danielmicay@gmail.com>
Date: Mon, 19 Sep 2016 07:57:43 -0400
Subject: [PATCH] fix undefined out-of-bounds accesses in sched.h

---
 libc/include/sched.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libc/include/sched.h b/libc/include/sched.h
index 1f5036677..fc622cbd7 100644
--- a/libc/include/sched.h
+++ b/libc/include/sched.h
@@ -71,7 +71,10 @@ int setns(int __fd, int __ns_type) __INTRODUCED_IN(21);
 #define __CPU_MASK(x)  ((__CPU_BITTYPE)1 << ((x) & (__CPU_BITS - 1)))
 
 typedef struct {
-  __CPU_BITTYPE  __bits[ CPU_SETSIZE / __CPU_BITS ];
+  union {
+    __CPU_BITTYPE  __bits_minimum[ CPU_SETSIZE / __CPU_BITS ];
+    __CPU_BITTYPE  __bits[0];
+  };
 } cpu_set_t;
 
 int sched_setaffinity(pid_t __pid, size_t __set_size, const cpu_set_t* __set) __INTRODUCED_IN(12);
