Fix stack buffer overflow

Fix a stack buffer overflow found by running MemorySanitizer.
This commit is contained in:
Farid Zakaria
2021-11-18 04:05:25 +00:00
parent 480c883f36
commit bc14465e08
+1 -1
View File
@@ -54,7 +54,7 @@ void RefScanSink::operator () (std::string_view data)
fragment, so search in the concatenation of the tail of the
previous fragment and the start of the current fragment. */
auto s = tail;
s.append(data.data(), refLength);
s.append(data.data(), std::min(data.size(), refLength));
search(s, hashes, seen);
search(data, hashes, seen);