From abb963a06d6f2b7f6d39bbe34c5b6d581d79480e Mon Sep 17 00:00:00 2001 From: Christopher Dykes Date: Wed, 3 Aug 2016 15:09:04 -0700 Subject: [PATCH] Force the overflow in BitVectorCoding::skipTo to be 64-bit Summary: This code was relying on the `- 1` overflowing as a 64-bit value, but MSVC (correctly in my opinion) was overflowing this as a 32-bit value, resulting in a segfault when trying to run the bitvector and eliasfano tests on MSVC. Reviewed By: yfeldblum Differential Revision: D3652343 fbshipit-source-id: 38a22abfc0d05ab2f070c450eebfa69af07d26af --- folly/experimental/BitVectorCoding.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/folly/experimental/BitVectorCoding.h b/folly/experimental/BitVectorCoding.h index d51b7b96..a7f711c2 100644 --- a/folly/experimental/BitVectorCoding.h +++ b/folly/experimental/BitVectorCoding.h @@ -346,8 +346,8 @@ class BitVectorReader { if (Encoder::skipQuantum > 0 && v - value_ > Encoder::skipQuantum) { size_t q = v / Encoder::skipQuantum; - position_ = folly::loadUnaligned( - skipPointers_ + (q - 1) * sizeof(SkipValueType)) - 1; + position_ = size_t(folly::loadUnaligned( + skipPointers_ + (q - 1) * sizeof(SkipValueType))) - 1; reposition(q * Encoder::skipQuantum); } -- 2.34.1