diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2012-09-26 15:52:15 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2012-09-26 15:52:15 +0000 |
commit | 696e06e4535e4e5125020b6cb5a14935ea06e6a2 (patch) | |
tree | c53f9e9ba48b9b695e47f8c422846b3742bad42e /lib/Support | |
parent | be3338a5de14595e51028bccfd10d696daf87021 (diff) |
YAMLParser: Fix invalid reads when encountering incorrectly quoted scalar.
Fixes PR12632.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164701 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support')
-rw-r--r-- | lib/Support/YAMLParser.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/Support/YAMLParser.cpp b/lib/Support/YAMLParser.cpp index 7c353c89bb..34df636a72 100644 --- a/lib/Support/YAMLParser.cpp +++ b/lib/Support/YAMLParser.cpp @@ -903,6 +903,7 @@ bool Scanner::consume(uint32_t Expected) { void Scanner::skip(uint32_t Distance) { Current += Distance; Column += Distance; + assert(Current <= End && "Skipped past the end"); } bool Scanner::isBlankOrBreak(StringRef::iterator Position) { @@ -1239,6 +1240,12 @@ bool Scanner::scanFlowScalar(bool IsDoubleQuoted) { } } } + + if (Current == End) { + setError("Expected quote at end of scalar", Current); + return false; + } + skip(1); // Skip ending quote. Token T; T.Kind = Token::TK_Scalar; |