Fix unescaping bug
This commit is contained in:
@@ -501,10 +501,10 @@ inline Status t_hex2(Parser3 *self) {
|
|||||||
// there's not room, flush, write into a temp buffer, and flush again.
|
// there's not room, flush, write into a temp buffer, and flush again.
|
||||||
char tmp[3];
|
char tmp[3];
|
||||||
if (self->utf8Codepoint < 0x80) {
|
if (self->utf8Codepoint < 0x80) {
|
||||||
assert(self->bufEnd - self->writeBuf >= 1);
|
assert(self->buf - self->writeBuf >= 1);
|
||||||
*self->writeBuf++ = self->utf8Codepoint;
|
*self->writeBuf++ = self->utf8Codepoint;
|
||||||
} else if (self->utf8Codepoint < 0x800) {
|
} else if (self->utf8Codepoint < 0x800) {
|
||||||
bool useTmp = self->bufEnd - self->writeBuf < 2;
|
bool useTmp = self->buf - self->writeBuf < 2;
|
||||||
char *p = tmp;
|
char *p = tmp;
|
||||||
if (useTmp) {
|
if (useTmp) {
|
||||||
self->flushString();
|
self->flushString();
|
||||||
@@ -530,7 +530,7 @@ inline Status t_hex2(Parser3 *self) {
|
|||||||
}
|
}
|
||||||
MUSTTAIL return Parser3::keepGoing(self);
|
MUSTTAIL return Parser3::keepGoing(self);
|
||||||
}
|
}
|
||||||
bool useTmp = self->bufEnd - self->writeBuf < 3;
|
bool useTmp = self->buf - self->writeBuf < 3;
|
||||||
char *p = tmp;
|
char *p = tmp;
|
||||||
if (useTmp) {
|
if (useTmp) {
|
||||||
self->flushString();
|
self->flushString();
|
||||||
@@ -579,7 +579,7 @@ inline Status t_hex3(Parser3 *self) {
|
|||||||
if (self->utf8Codepoint > 0x10FFFF) {
|
if (self->utf8Codepoint > 0x10FFFF) {
|
||||||
return S_REJECT;
|
return S_REJECT;
|
||||||
}
|
}
|
||||||
bool useTmp = self->bufEnd - self->writeBuf < 4;
|
bool useTmp = self->buf - self->writeBuf < 4;
|
||||||
char *p = tmp;
|
char *p = tmp;
|
||||||
if (useTmp) {
|
if (useTmp) {
|
||||||
self->flushString();
|
self->flushString();
|
||||||
|
|||||||
Reference in New Issue
Block a user