llvm.org GIT mirror llvm / 629f3b2
Fix a buffer overrun detected by AddressSanitizer. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197647 91177308-0d34-0410-b5e6-96231b3b80d8 Anna Zaks 5 years ago
2 changed file(s) with 10 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
266266 Bits[I / BITWORD_SIZE] = ~0UL;
267267
268268 BitWord PostfixMask = (1UL << (E % BITWORD_SIZE)) - 1;
269 Bits[I / BITWORD_SIZE] |= PostfixMask;
269 if (I < E)
270 Bits[I / BITWORD_SIZE] |= PostfixMask;
270271
271272 return *this;
272273 }
304305 Bits[I / BITWORD_SIZE] = 0UL;
305306
306307 BitWord PostfixMask = (1UL << (E % BITWORD_SIZE)) - 1;
307 Bits[I / BITWORD_SIZE] &= ~PostfixMask;
308 if (I < E)
309 Bits[I / BITWORD_SIZE] &= ~PostfixMask;
308310
309311 return *this;
310312 }
355355 EXPECT_TRUE( E.test(1));
356356 EXPECT_TRUE( E.test(32));
357357 EXPECT_FALSE(E.test(33));
358
359 TypeParam BufferOverrun;
360 unsigned size = sizeof(unsigned long) * 8;
361 BufferOverrun.resize(size);
362 BufferOverrun.reset(0, size);
363 BufferOverrun.set(0, size);
358364 }
359365
360366 TYPED_TEST(BitVectorTest, CompoundTestReset) {