From 460da417e8a8f2fdc14f7099a58d6ed2c7c47d27 Mon Sep 17 00:00:00 2001 From: Karl Schimpf Date: Mon, 31 Aug 2015 21:36:14 +0000 Subject: [PATCH] Fix bug in method LLLexer::FP80HexToIntPair git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246489 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/AsmParser/LLLexer.cpp | 2 +- test/Assembler/invalid-fp80hex.ll | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 test/Assembler/invalid-fp80hex.ll diff --git a/lib/AsmParser/LLLexer.cpp b/lib/AsmParser/LLLexer.cpp index 6d62584577a..af7705c5666 100644 --- a/lib/AsmParser/LLLexer.cpp +++ b/lib/AsmParser/LLLexer.cpp @@ -105,7 +105,7 @@ void LLLexer::FP80HexToIntPair(const char *Buffer, const char *End, Pair[1] += hexDigitValue(*Buffer); } Pair[0] = 0; - for (int i=0; i<16; i++, Buffer++) { + for (int i = 0; i < 16 && Buffer != End; i++, Buffer++) { Pair[0] *= 16; Pair[0] += hexDigitValue(*Buffer); } diff --git a/test/Assembler/invalid-fp80hex.ll b/test/Assembler/invalid-fp80hex.ll new file mode 100644 index 00000000000..70c518dd648 --- /dev/null +++ b/test/Assembler/invalid-fp80hex.ll @@ -0,0 +1,6 @@ +; RUN: not llvm-as < %s 2>&1 | FileCheck %s + +; Tests bug: 24640 +; CHECK: expected '=' in global variable + +@- 0xKate potb8ed -- 2.34.1