mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-31 15:53:42 +00:00
Not handling zero length strings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31277 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
ba726ab3ec
commit
d8cb446aa2
@ -61,7 +61,7 @@ void FoldingSetImpl::NodeID::AddString(const std::string &String) {
|
||||
Pos = Units * sizeof(unsigned);
|
||||
} else {
|
||||
// Otherwise do it the hard way.
|
||||
for ( Pos += 4; Pos < Size; Pos += 4) {
|
||||
for ( Pos += 4; Pos <= Size; Pos += 4) {
|
||||
unsigned V = ((unsigned char)String[Pos - 4] << 24) |
|
||||
((unsigned char)String[Pos - 3] << 16) |
|
||||
((unsigned char)String[Pos - 2] << 8) |
|
||||
@ -77,7 +77,7 @@ void FoldingSetImpl::NodeID::AddString(const std::string &String) {
|
||||
case 1: V = (V << 8) | (unsigned char)String[Size - 3]; // Fall thru.
|
||||
case 2: V = (V << 8) | (unsigned char)String[Size - 2]; // Fall thru.
|
||||
case 3: V = (V << 8) | (unsigned char)String[Size - 1]; break;
|
||||
case 0: return; // Nothing left.
|
||||
default: return; // Nothing left.
|
||||
}
|
||||
|
||||
Bits.push_back(V);
|
||||
|
Loading…
x
Reference in New Issue
Block a user