Avoid undefined behavior from out-of-range access. NFC.
This commit is contained in:
parent
b8ee0e941b
commit
bedea1ef3c
@ -214,7 +214,7 @@ class ReadUTF8 {
|
|||||||
public:
|
public:
|
||||||
ReadUTF8(const std::string &str) : str(str) {}
|
ReadUTF8(const std::string &str) : str(str) {}
|
||||||
utf8_iterator begin() const { return utf8_iterator(&str[0]); }
|
utf8_iterator begin() const { return utf8_iterator(&str[0]); }
|
||||||
utf8_iterator end() const { return utf8_iterator(&str[str.length()]); }
|
utf8_iterator end() const { return utf8_iterator(&str[0] + str.length()); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user