From bbc6f8b78695d6894a943dec521b66f4099c6338 Mon Sep 17 00:00:00 2001 From: Tim Quatmann Date: Mon, 9 Mar 2020 15:46:31 +0100 Subject: [PATCH] Fixed invalid memory access when applying BitVector::resize on BitVectors of length 0. --- src/storm/storage/BitVector.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/storm/storage/BitVector.cpp b/src/storm/storage/BitVector.cpp index 271568c7f..a4ad5fca9 100644 --- a/src/storm/storage/BitVector.cpp +++ b/src/storm/storage/BitVector.cpp @@ -219,7 +219,9 @@ namespace storm { uint64_t* newBuckets = new uint64_t[newBucketCount]; std::copy_n(buckets, this->bucketCount(), newBuckets); if (init) { - newBuckets[this->bucketCount() - 1] |= ((1ull << (64 - (bitCount & mod64mask))) - 1ull); + if (this->bucketCount() > 0) { + newBuckets[this->bucketCount() - 1] |= ((1ull << (64 - (bitCount & mod64mask))) - 1ull); + } std::fill_n(newBuckets + this->bucketCount(), newBucketCount - this->bucketCount(), -1ull); } else { std::fill_n(newBuckets + this->bucketCount(), newBucketCount - this->bucketCount(), 0);