diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2023-02-10 19:20:43 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2023-02-10 19:20:43 +0100 |
commit | 56d065041793509a6f60671f6ae3400698bd5639 (patch) | |
tree | 99110de94896068a591387f02722763d064c5802 /libstore | |
parent | b7287f6c4830d2957645abb3217f46489dc7bea3 (diff) | |
download | hurd-56d065041793509a6f60671f6ae3400698bd5639.tar.gz hurd-56d065041793509a6f60671f6ae3400698bd5639.tar.bz2 hurd-56d065041793509a6f60671f6ae3400698bd5639.zip |
libstore: Fix undefined behavior
store_offset_t is a signed type, so 1 << (bits-1) overflows.
Diffstat (limited to 'libstore')
-rw-r--r-- | libstore/zero.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libstore/zero.c b/libstore/zero.c index 878b2271..2960c18a 100644 --- a/libstore/zero.c +++ b/libstore/zero.c @@ -151,7 +151,7 @@ zero_open (const char *name, int flags, else { store_offset_t max_offs = ~((store_offset_t)1 - << (CHAR_BIT * sizeof (store_offset_t) - 1)); + << (CHAR_BIT * sizeof (store_offset_t) - 2)); return store_zero_create (max_offs, flags, store); } } |