forked from lix-project/lix
Merge branch 'base32-overflow' of git://github.com/vcunat/nix
This commit is contained in:
commit
f867f090ed
|
@ -165,7 +165,13 @@ Hash parseHash32(HashType ht, const string & s)
|
||||||
unsigned int i = b / 8;
|
unsigned int i = b / 8;
|
||||||
unsigned int j = b % 8;
|
unsigned int j = b % 8;
|
||||||
hash.hash[i] |= digit << j;
|
hash.hash[i] |= digit << j;
|
||||||
if (i < hash.hashSize - 1) hash.hash[i + 1] |= digit >> (8 - j);
|
|
||||||
|
if (i < hash.hashSize - 1) {
|
||||||
|
hash.hash[i + 1] |= digit >> (8 - j);
|
||||||
|
} else {
|
||||||
|
if (digit >> (8 - j))
|
||||||
|
throw BadHash(format("invalid base-32 hash ‘%1%’") % s);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return hash;
|
return hash;
|
||||||
|
|
Loading…
Reference in a new issue