Merge branch 'base32-overflow' of git://github.com/vcunat/nix
This commit is contained in:
		
						commit
						f867f090ed
					
				
					 1 changed files with 7 additions and 1 deletions
				
			
		| 
						 | 
					@ -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…
	
	Add table
		Add a link
		
	
		Reference in a new issue