diff options
| author | Shinichiro Hamaji <shinichiro.hamaji@gmail.com> | 2016-02-29 20:00:39 +0900 |
|---|---|---|
| committer | Shinichiro Hamaji <shinichiro.hamaji@gmail.com> | 2016-02-29 20:00:39 +0900 |
| commit | 4a888024476b76f8ad7e10266ce179f0fc8af077 (patch) | |
| tree | 004b44f32721e3518e1c7fd36af7ef707e96d0ee /strutil.cc | |
| parent | 01406297a23201b3f99dfb316e7bb4e64b0472c3 (diff) | |
[C++] Honor string length in FindEndOfLine
When the character after the string is a backslash,
FindOfLine returned a wrong length.
Diffstat (limited to 'strutil.cc')
| -rw-r--r-- | strutil.cc | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -427,6 +427,10 @@ size_t FindEndOfLine(StringPiece s, size_t e, size_t* lf_cnt) { static const char ranges[] = "\0\0\n\n\\\\"; while (e < s.size()) { e += SkipUntilSSE42(s.data() + e, s.size() - e, ranges, 6); + if (e >= s.size()) { + CHECK(s.size() == e); + break; + } char c = s[e]; if (c == '\0') break; |
