Merge pull request #4008 from aszlig/fix-ub-in-reading-ca-map

Fix unspecified behaviour in readStorePathCAMap
This commit is contained in:
Eelco Dolstra 2020-09-14 13:18:52 +02:00 committed by GitHub
commit 8ebd10664e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -43,8 +43,11 @@ StorePathCAMap readStorePathCAMap(const Store & store, Source & from)
{
StorePathCAMap paths;
auto count = readNum<size_t>(from);
while (count--)
paths.insert_or_assign(store.parseStorePath(readString(from)), parseContentAddressOpt(readString(from)));
while (count--) {
auto path = store.parseStorePath(readString(from));
auto ca = parseContentAddressOpt(readString(from));
paths.insert_or_assign(path, ca);
}
return paths;
}