commit | 5ed61fe6a108636a6f3de37d21ad80452f4c05a3 | [log] [tgz] |
---|---|---|
author | Dan Gohman <gohman@apple.com> | Thu Nov 18 17:14:56 2010 +0000 |
committer | Dan Gohman <gohman@apple.com> | Thu Nov 18 17:14:56 2010 +0000 |
tree | 2b324fb0fd6f3c30f89e353a131b0dd78c4c15aa | |
parent | 21a968364110442986077e86bd7a51fd0d86f974 [diff] [blame] |
Bounds-check APInt's operator[]. llvm-svn: 119708
diff --git a/llvm/lib/Support/APInt.cpp b/llvm/lib/Support/APInt.cpp index 88f9ac6..6bbe9ab 100644 --- a/llvm/lib/Support/APInt.cpp +++ b/llvm/lib/Support/APInt.cpp
@@ -483,6 +483,7 @@ } bool APInt::operator[](unsigned bitPosition) const { + assert(bitPosition < getBitWidth() && "Bit position out of bounds!"); return (maskBit(bitPosition) & (isSingleWord() ? VAL : pVal[whichWord(bitPosition)])) != 0; }