summaryrefslogtreecommitdiffstats
path: root/llvm/lib/AsmParser
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2014-12-09 19:10:03 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2014-12-09 19:10:03 +0000
commit2defbada38d1a8fe8c215aa162b26e4db19e69b3 (patch)
treebc5e6108bccb0ea05bebea50dfaf681976fcd45d /llvm/lib/AsmParser
parent10aa0320b6be78bc741e6e90bfd2132751dcddcb (diff)
downloadbcm5719-llvm-2defbada38d1a8fe8c215aa162b26e4db19e69b3.tar.gz
bcm5719-llvm-2defbada38d1a8fe8c215aa162b26e4db19e69b3.zip
AsmParser: Don't crash on short hex constants for fp128 types
If we see 0xL01, treat it like 0xL00000000000000000000000000000001 instead of crashing. llvm-svn: 223811
Diffstat (limited to 'llvm/lib/AsmParser')
-rw-r--r--llvm/lib/AsmParser/LLLexer.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/llvm/lib/AsmParser/LLLexer.cpp b/llvm/lib/AsmParser/LLLexer.cpp
index 614a283241e..d2ed616e782 100644
--- a/llvm/lib/AsmParser/LLLexer.cpp
+++ b/llvm/lib/AsmParser/LLLexer.cpp
@@ -78,13 +78,15 @@ uint64_t LLLexer::HexIntToVal(const char *Buffer, const char *End) {
void LLLexer::HexToIntPair(const char *Buffer, const char *End,
uint64_t Pair[2]) {
Pair[0] = 0;
- for (int i=0; i<16; i++, Buffer++) {
- assert(Buffer != End);
- Pair[0] *= 16;
- Pair[0] += hexDigitValue(*Buffer);
+ if (End - Buffer >= 16) {
+ for (int i = 0; i < 16; i++, Buffer++) {
+ assert(Buffer != End);
+ Pair[0] *= 16;
+ Pair[0] += hexDigitValue(*Buffer);
+ }
}
Pair[1] = 0;
- for (int i=0; i<16 && Buffer != End; i++, Buffer++) {
+ for (int i = 0; i < 16 && Buffer != End; i++, Buffer++) {
Pair[1] *= 16;
Pair[1] += hexDigitValue(*Buffer);
}
OpenPOWER on IntegriCloud