From 078d967e0a7e6dd78ac9eb28a1d50fd9319b88d1 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Thu, 18 Nov 2010 17:14:56 +0000 Subject: Bounds-check APInt's operator[]. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119708 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Support/APInt.cpp | 1 + 1 file changed, 1 insertion(+) 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; } -- cgit v1.2.3-18-g5258