From: Christopher Dykes Date: Wed, 3 Aug 2016 22:09:04 +0000 (-0700) Subject: Force the overflow in BitVectorCoding::skipTo to be 64-bit X-Git-Tag: v2016.08.08.00~27 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=abb963a06d6f2b7f6d39bbe34c5b6d581d79480e;p=folly.git 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 --- 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); }