mirror of
https://codeberg.org/guix/guix.git
synced 2025-10-02 02:15:12 +00:00
daemon: Read substitute nar size as 'unsigned long long'.
Fixes <https://issues.guix.gnu.org/46212>.
Reported by Christopher Baines <mail@cbaines.net>.
Previously, the nar size returned by 'guix substitute' would be read as
an 'int'; thus, values above 2^31 - 1 would be read and then stored as
negative integers in the database.
Regression introduced in 9dfa20a22a
.
* nix/libstore/build.cc (SubstitutionGoal::finished): Use templatized
'string2Int' instead of 'std::atoi' to get an 'unsigned long long',
which is the type of 'hash.second'.
* tests/store.scm ("substitute and large size"): New test.
This commit is contained in:
parent
1eb40a6dc4
commit
f9b1bb916c
2 changed files with 46 additions and 1 deletions
|
@ -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. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue