Fix bugs found through fuzzing

This commit is contained in:
2024-05-19 20:08:27 -07:00
parent e23f11c1f0
commit 89c6aae53a
2 changed files with 14 additions and 7 deletions

View File

@@ -29,12 +29,6 @@ struct Facade {
const int64_t v[] = {version, version};
facade->versioned.firstGeq(key, v, versionedIter, 2);
if (versionedIter[0] == versionedIter[1]) {
// No mutations intersect [begin, end)
facade->unversionedRead(begin, end, limit, reverse, result);
return result;
}
// Make sure versionedIter[1] param1 is >= `end`
if (versionedIter[1] != facade->versioned.end(version)) {
auto m = *versionedIter[1];
@@ -43,6 +37,12 @@ struct Facade {
}
}
if (versionedIter[0] == versionedIter[1]) {
// No mutations intersect [begin, end)
facade->unversionedRead(begin, end, limit, reverse, result);
return result;
}
static const uint8_t zero_[] = {0};
static const String zero{zero_, 1};

View File

@@ -653,7 +653,14 @@ struct __attribute__((__visibility__("hidden"))) VersionedMap::Impl {
rangeVersion = latestVersion;
if (inserted) {
val = {nullptr, -1}; // Sentinel for "no point mutation here"
pointVersion = -1; // Sentinel for "no point mutation here"
Finger copy;
finger.copyTo(copy);
move<std::memory_order_relaxed>(copy, latestVersion, true);
if (copy.searchPathSize() == 0) {
pointVersion = -1; // Sentinel for "no mutation ending here"
} else {
pointVersion = mm.base[copy.backNode()].entry->rangeVersion;
}
} else {
auto *entry = mm.base[finger.backNode()].entry;
val = {entry->getVal(), entry->valLen};