Fix out-of-bound access
This commit is contained in:
parent
ea62c64add
commit
4ce000b9f5
@ -143,7 +143,12 @@ private:
|
|||||||
public:
|
public:
|
||||||
DecodedStream(SourceStream& ss) : ss_(ss), codepoint_() { Decode(); }
|
DecodedStream(SourceStream& ss) : ss_(ss), codepoint_() { Decode(); }
|
||||||
unsigned Peek() { return codepoint_; }
|
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:
|
private:
|
||||||
void Decode() {
|
void Decode() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user