aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Support/APInt.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-11-18 17:14:56 +0000
committerDan Gohman <gohman@apple.com>2010-11-18 17:14:56 +0000
commit078d967e0a7e6dd78ac9eb28a1d50fd9319b88d1 (patch)
tree7de4eedeabc69edec35be7b566bdfe9c374745cd /lib/Support/APInt.cpp
parent409d64a7645ed94a1a23f6c3e03d46cb6d24b382 (diff)
downloadexternal_llvm-078d967e0a7e6dd78ac9eb28a1d50fd9319b88d1.zip
external_llvm-078d967e0a7e6dd78ac9eb28a1d50fd9319b88d1.tar.gz
external_llvm-078d967e0a7e6dd78ac9eb28a1d50fd9319b88d1.tar.bz2
Bounds-check APInt's operator[].
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119708 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/APInt.cpp')
-rw-r--r--lib/Support/APInt.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/Support/APInt.cpp b/lib/Support/APInt.cpp
index 88f9ac6..6bbe9ab 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;
}