mirror of
https://github.com/apple/foundationdb.git
synced 2025-05-16 02:42:23 +08:00
fix: when more tlogs are absent than the replication factor we would access invalid memory
This commit is contained in:
parent
79063d5fc4
commit
a825eb8a8c
@ -1908,7 +1908,7 @@ Optional<std::tuple<Version, Version, std::vector<TLogLockResult>>> TagPartition
|
|||||||
int absent = logSet->logServers.size() - results.size();
|
int absent = logSet->logServers.size() - results.size();
|
||||||
int safe_range_begin = logSet->tLogWriteAntiQuorum;
|
int safe_range_begin = logSet->tLogWriteAntiQuorum;
|
||||||
int new_safe_range_begin = std::min(logSet->tLogWriteAntiQuorum, (int)(results.size() - 1));
|
int new_safe_range_begin = std::min(logSet->tLogWriteAntiQuorum, (int)(results.size() - 1));
|
||||||
int safe_range_end = logSet->tLogReplicationFactor - absent;
|
int safe_range_end = std::max(logSet->tLogReplicationFactor - absent, 1);
|
||||||
|
|
||||||
if (!lastEnd.present() || ((safe_range_end > 0) && (safe_range_end - 1 < results.size()) &&
|
if (!lastEnd.present() || ((safe_range_end > 0) && (safe_range_end - 1 < results.size()) &&
|
||||||
results[safe_range_end - 1].end < lastEnd.get())) {
|
results[safe_range_end - 1].end < lastEnd.get())) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user