diff options
author | 2017-10-06 14:22:22 -0400 | |
---|---|---|
committer | 2017-10-17 21:05:11 +0000 | |
commit | e148bf714e39ad006d82d99ed40f2ad1dfa6b905 (patch) | |
tree | e20cd4884ddbd0389ae3523d5bdcb96a61a682af /src/sksl/lex/Main.cpp | |
parent | 84366d22d6535dd955d9aa14bb0f364381c3f45d (diff) |
fix for SkSL lexer crash on non-ASCII input
Bug: skia:7126
Change-Id: Ic884d14daf91fd668afe9e29d2f82d1ef1089cce
Reviewed-on: https://skia-review.googlesource.com/56720
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Diffstat (limited to 'src/sksl/lex/Main.cpp')
-rw-r--r-- | src/sksl/lex/Main.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/sksl/lex/Main.cpp b/src/sksl/lex/Main.cpp index ff5d6619a1..fe06a874d3 100644 --- a/src/sksl/lex/Main.cpp +++ b/src/sksl/lex/Main.cpp @@ -141,6 +141,9 @@ void writeCPP(const DFA& dfa, const char* lexer, const char* token, const char* out << " " << token << "::Kind lastAccept = " << token << "::Kind::INVALID;\n"; out << " int lastAcceptEnd = startOffset + 1;\n"; out << " while (offset < fLength) {\n"; + out << " if ((uint8_t) fText[offset] >= " << dfa.fCharMappings.size() << ") {"; + out << " break;"; + out << " }"; out << " state = transitions[mappings[(int) fText[offset]]][state];\n"; out << " ++offset;\n"; out << " if (!state) {\n"; |