swift
e180bf9d - [Parse] Tweak a utility function that relies on reading past the end (#19230)

Commit
7 years ago
[Parse] Tweak a utility function that relies on reading past the end (#19230) Lexer::getEncodedStringSegment (now getEncodedStringSegmentImpl) assumes that it can read one byte past the end of a string segment in order to avoid bounds-checks on things like "is this a \r\n sequence?". However, the function was being used for strings that did not come from source where this assumption was not always valid. Change the reusable form of the function to always copy into a temporary buffer, allowing the fast path to continue to be used for normal parsing. Caught by ASan! rdar://problem/44306756
Author
Parents
Loading