diff options
author | Dan Gohman <gohman@apple.com> | 2010-11-18 17:14:56 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-11-18 17:14:56 +0000 |
commit | 078d967e0a7e6dd78ac9eb28a1d50fd9319b88d1 (patch) | |
tree | 7de4eedeabc69edec35be7b566bdfe9c374745cd | |
parent | 409d64a7645ed94a1a23f6c3e03d46cb6d24b382 (diff) |
Bounds-check APInt's operator[].
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119708 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Support/APInt.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/Support/APInt.cpp b/lib/Support/APInt.cpp index 88f9ac63f7..6bbe9ab463 100644 --- a/lib/Support/APInt.cpp +++ b/lib/Support/APInt.cpp @@ -483,6 +483,7 @@ APInt APInt::operator-(const APInt& RHS) const { } bool APInt::operator[](unsigned bitPosition) const { + assert(bitPosition < getBitWidth() && "Bit position out of bounds!"); return (maskBit(bitPosition) & (isSingleWord() ? VAL : pVal[whichWord(bitPosition)])) != 0; } |