forked from OSchip/llvm-project
[Support/YAMLParser] Fix ASan found bugs.
llvm-svn: 155735
This commit is contained in:
parent
42cd8d2c00
commit
6033113e35
|
@ -755,6 +755,8 @@ Token Scanner::getNext() {
|
||||||
}
|
}
|
||||||
|
|
||||||
StringRef::iterator Scanner::skip_nb_char(StringRef::iterator Position) {
|
StringRef::iterator Scanner::skip_nb_char(StringRef::iterator Position) {
|
||||||
|
if (Position == End)
|
||||||
|
return Position;
|
||||||
// Check 7 bit c-printable - b-char.
|
// Check 7 bit c-printable - b-char.
|
||||||
if ( *Position == 0x09
|
if ( *Position == 0x09
|
||||||
|| (*Position >= 0x20 && *Position <= 0x7E))
|
|| (*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) {
|
StringRef::iterator Scanner::skip_b_break(StringRef::iterator Position) {
|
||||||
|
if (Position == End)
|
||||||
|
return Position;
|
||||||
if (*Position == 0x0D) {
|
if (*Position == 0x0D) {
|
||||||
if (Position + 1 != End && *(Position + 1) == 0x0A)
|
if (Position + 1 != End && *(Position + 1) == 0x0A)
|
||||||
return Position + 2;
|
return Position + 2;
|
||||||
|
@ -1211,7 +1215,9 @@ bool Scanner::scanFlowScalar(bool IsDoubleQuoted) {
|
||||||
++Current;
|
++Current;
|
||||||
// Repeat until the previous character was not a '\' or was an escaped
|
// Repeat until the previous character was not a '\' or was an escaped
|
||||||
// backslash.
|
// backslash.
|
||||||
} while (*(Current - 1) == '\\' && wasEscaped(Start + 1, Current));
|
} while ( Current != End
|
||||||
|
&& *(Current - 1) == '\\'
|
||||||
|
&& wasEscaped(Start + 1, Current));
|
||||||
} else {
|
} else {
|
||||||
skip(1);
|
skip(1);
|
||||||
while (true) {
|
while (true) {
|
||||||
|
|
Loading…
Reference in New Issue