Commit 4ce000b9 authored by Milo Yip's avatar Milo Yip

Fix out-of-bound access

parent ea62c64a
......@@ -143,7 +143,12 @@ private:
public:
DecodedStream(SourceStream& ss) : ss_(ss), codepoint_() { Decode(); }
unsigned Peek() { return codepoint_; }
unsigned Take() { unsigned c = codepoint_; Decode(); return c; }
unsigned Take() {
unsigned c = codepoint_;
if (c) // No further decoding when '\0'
Decode();
return c;
}
private:
void Decode() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment