Skip to content

Commit 8dcbe38

Browse files
authored
fix: Escape \u if following 4 characters is not hex digits
1 parent 0599b53 commit 8dcbe38

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/serializer.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ static void jx_EncodeJsonStream (PSTREAM p , PUCHAR in)
5151
}
5252
}
5353
else if (c == pJw->backSlash) {
54-
if (in[1] != 'u') { // Dont double escape unicode escape sequence
54+
if (in[1] != 'u' // Dont double escape unicode escape sequence
55+
|| !isxdigit(in[2]) || !isxdigit(in[3])
56+
|| !isxdigit(in[4]) || !isxdigit(in[5])) {
5557
stream_putc(p,pJw->backSlash);
5658
}
5759
}

0 commit comments

Comments
 (0)