diff options
author | John McCall <rjmccall@apple.com> | 2010-03-01 18:38:45 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-03-01 18:38:45 +0000 |
commit | c6dbe30e8831722e0ebf44345414275e723fa01a (patch) | |
tree | 3935a6e7c5681f529480adba0bc86d6a539eb547 /llvm/lib/Support | |
parent | 1392621e0f97225416c5b7babe08c986d99ffdcd (diff) | |
download | bcm5719-llvm-c6dbe30e8831722e0ebf44345414275e723fa01a.tar.gz bcm5719-llvm-c6dbe30e8831722e0ebf44345414275e723fa01a.zip |
Don't potentially read past the end of the fill data when making a NaN from
an APInt.
llvm-svn: 97467
Diffstat (limited to 'llvm/lib/Support')
-rw-r--r-- | llvm/lib/Support/APFloat.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Support/APFloat.cpp b/llvm/lib/Support/APFloat.cpp index 16a0c232927..619f061862c 100644 --- a/llvm/lib/Support/APFloat.cpp +++ b/llvm/lib/Support/APFloat.cpp @@ -638,7 +638,8 @@ void APFloat::makeNaN(bool SNaN, bool Negative, const APInt *fill) if (!fill || fill->getNumWords() < numParts) APInt::tcSet(significand, 0, numParts); if (fill) { - APInt::tcAssign(significand, fill->getRawData(), partCount()); + APInt::tcAssign(significand, fill->getRawData(), + std::min(fill->getNumWords(), numParts)); // Zero out the excess bits of the significand. unsigned bitsToPreserve = semantics->precision - 1; |