summaryrefslogtreecommitdiff
path: root/nix
diff options
context:
space:
mode:
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);
}
}