summaryrefslogtreecommitdiff
path: root/nix
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2021-12-05 19:17:41 +0100
committerRicardo Wurmus <rekado@elephly.net>2021-12-05 19:17:41 +0100
commit9bc0f45df5d6aed217020b1183dca54989844fb0 (patch)
treed927e89949ff7f65b5059bc94273c53fd43d0763 /nix
parent6db3c536e89deb8a204e756f427614925a7d2582 (diff)
parent10554e0a57feeea470127a1d0441957d1776b0bd (diff)
downloadguix-patches-9bc0f45df5d6aed217020b1183dca54989844fb0.tar
guix-patches-9bc0f45df5d6aed217020b1183dca54989844fb0.tar.gz
Merge remote-tracking branch 'origin/master' into core-updates-frozen
Diffstat (limited to 'nix')
-rw-r--r--nix/libstore/build.cc3
-rw-r--r--nix/libstore/local-store.cc7
2 files changed, 6 insertions, 4 deletions
diff --git a/nix/libstore/build.cc b/nix/libstore/build.cc
index 5697ae5a43..f6431bb726 100644
--- a/nix/libstore/build.cc
+++ b/nix/libstore/build.cc
@@ -3102,7 +3102,8 @@ void SubstitutionGoal::finished()
throw Error(format("unknown hash algorithm in `%1%'") % hashStr);
case htSHA256:
hash.first = parseHash16or32(hashType, string(hashStr, n + 1));
- hash.second = std::atoi(statusList[2].c_str());
+ if (!string2Int(statusList[2], hash.second))
+ throw Error(format("invalid nar size for '%1%' substitute") % storePath);
break;
default:
/* The database only stores SHA256 hashes, so compute it. */
diff --git a/nix/libstore/local-store.cc b/nix/libstore/local-store.cc
index 675d1ba66f..0883a4bbce 100644
--- a/nix/libstore/local-store.cc
+++ b/nix/libstore/local-store.cc
@@ -839,7 +839,8 @@ template<class T> T LocalStore::getIntLineFromSubstituter(Agent & run)
{
string s = getLineFromSubstituter(run);
T res;
- if (!string2Int(s, res)) throw Error("integer expected from stream");
+ if (!string2Int(s, res))
+ throw Error(format("integer expected from stream: %1%") % s);
return res;
}
@@ -907,8 +908,8 @@ void LocalStore::querySubstitutablePathInfos(PathSet & paths, SubstitutablePathI
assertStorePath(p);
info.references.insert(p);
}
- info.downloadSize = getIntLineFromSubstituter<long long>(run);
- info.narSize = getIntLineFromSubstituter<long long>(run);
+ info.downloadSize = getIntLineFromSubstituter<unsigned long long>(run);
+ info.narSize = getIntLineFromSubstituter<unsigned long long>(run);
}
}