1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 19:52:54 +01:00

YAMLParser: Fix invalid reads when encountering incorrectly quoted scalar.

Fixes PR12632.

llvm-svn: 164701
This commit is contained in:
Benjamin Kramer 2012-09-26 15:52:15 +00:00
parent 9cd31639d0
commit e7022be429

View File

@ -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;