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

@@ -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};