diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2016-07-21T16·35+0200 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2016-07-21T16·35+0200 |
commit | ea8e8df6c783fd9c0185d31ffca4e518a43fe247 (patch) | |
tree | f6216beade6d2aa4379d9e2f8dc327ea9f0846dd /src/libstore | |
parent | e682a8e138c44e557c57a8dcf33555ad7790dd8c (diff) |
NarInfo::NarInfo(): Ensure that we get a NAR size/hash
Diffstat (limited to 'src/libstore')
-rw-r--r-- | src/libstore/nar-info.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libstore/nar-info.cc b/src/libstore/nar-info.cc index 1aacca84b800..b0a8d77c2fba 100644 --- a/src/libstore/nar-info.cc +++ b/src/libstore/nar-info.cc @@ -6,7 +6,7 @@ namespace nix { NarInfo::NarInfo(const Store & store, const std::string & s, const std::string & whence) { auto corrupt = [&]() { - throw Error("NAR info file ‘%1%’ is corrupt"); + throw Error(format("NAR info file ‘%1%’ is corrupt") % whence); }; auto parseHashField = [&](const string & s) { @@ -73,7 +73,7 @@ NarInfo::NarInfo(const Store & store, const std::string & s, const std::string & if (compression == "") compression = "bzip2"; - if (path.empty() || url.empty()) corrupt(); + if (path.empty() || url.empty() || narSize == 0 || !narHash) corrupt(); } std::string NarInfo::to_string() const |