diff options
author | Michael J. Spencer <bigcheesegs@gmail.com> | 2012-04-27 21:12:20 +0000 |
---|---|---|
committer | Michael J. Spencer <bigcheesegs@gmail.com> | 2012-04-27 21:12:20 +0000 |
commit | 6033113e3501f59131e3a8c2511cbe3ce21738a1 (patch) | |
tree | 83ad670bee248cf75f0c6add2d3a10cd3bb435f8 /llvm/lib/Support/YAMLParser.cpp | |
parent | 42cd8d2c005a596cfade359114062ee44e9f86d0 (diff) | |
download | bcm5719-llvm-6033113e3501f59131e3a8c2511cbe3ce21738a1.tar.gz bcm5719-llvm-6033113e3501f59131e3a8c2511cbe3ce21738a1.zip |
[Support/YAMLParser] Fix ASan found bugs.
llvm-svn: 155735
Diffstat (limited to 'llvm/lib/Support/YAMLParser.cpp')
-rw-r--r-- | llvm/lib/Support/YAMLParser.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/llvm/lib/Support/YAMLParser.cpp b/llvm/lib/Support/YAMLParser.cpp index 8526d9adae3..fbb6ce95bd5 100644 --- a/llvm/lib/Support/YAMLParser.cpp +++ b/llvm/lib/Support/YAMLParser.cpp @@ -755,6 +755,8 @@ Token Scanner::getNext() { } StringRef::iterator Scanner::skip_nb_char(StringRef::iterator Position) { + if (Position == End) + return Position; // Check 7 bit c-printable - b-char. if ( *Position == 0x09 || (*Position >= 0x20 && *Position <= 0x7E)) @@ -778,6 +780,8 @@ StringRef::iterator Scanner::skip_nb_char(StringRef::iterator Position) { } StringRef::iterator Scanner::skip_b_break(StringRef::iterator Position) { + if (Position == End) + return Position; if (*Position == 0x0D) { if (Position + 1 != End && *(Position + 1) == 0x0A) return Position + 2; @@ -1211,7 +1215,9 @@ bool Scanner::scanFlowScalar(bool IsDoubleQuoted) { ++Current; // Repeat until the previous character was not a '\' or was an escaped // backslash. - } while (*(Current - 1) == '\\' && wasEscaped(Start + 1, Current)); + } while ( Current != End + && *(Current - 1) == '\\' + && wasEscaped(Start + 1, Current)); } else { skip(1); while (true) { |