Added unittests for invalid ascii control chars
This commit is contained in:
parent
da4fd6794c
commit
3c6e2cf030
@ -725,6 +725,8 @@ TEST(Reader, ParseString_Error) {
|
|||||||
|
|
||||||
// Malform ASCII sequence
|
// Malform ASCII sequence
|
||||||
TEST_STRINGENCODING_ERROR(ASCII<>, UTF8<>, char, ARRAY('[', '\"', char(0x80u), '\"', ']', '\0'));
|
TEST_STRINGENCODING_ERROR(ASCII<>, UTF8<>, char, ARRAY('[', '\"', char(0x80u), '\"', ']', '\0'));
|
||||||
|
TEST_STRINGENCODING_ERROR(ASCII<>, UTF8<>, char, ARRAY('[', '\"', char(0x01u), '\"', ']', '\0'));
|
||||||
|
TEST_STRINGENCODING_ERROR(ASCII<>, UTF8<>, char, ARRAY('[', '\"', char(0x1Cu), '\"', ']', '\0'));
|
||||||
|
|
||||||
#undef ARRAY
|
#undef ARRAY
|
||||||
#undef TEST_STRINGARRAY_ERROR
|
#undef TEST_STRINGARRAY_ERROR
|
||||||
|
@ -401,6 +401,16 @@ TEST(Writer, InvalidEncoding) {
|
|||||||
static const UTF32<>::Ch s[] = { 0x110000, 0 }; // Out of U+0000 to U+10FFFF
|
static const UTF32<>::Ch s[] = { 0x110000, 0 }; // Out of U+0000 to U+10FFFF
|
||||||
EXPECT_FALSE(writer.String(s));
|
EXPECT_FALSE(writer.String(s));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fail in decoding invalid ASCII control bytes
|
||||||
|
{
|
||||||
|
GenericStringBuffer<UTF16<> > buffer;
|
||||||
|
Writer<GenericStringBuffer<UTF16<> >, UTF8<>, UTF16<> > writer(buffer);
|
||||||
|
writer.StartArray();
|
||||||
|
EXPECT_FALSE(writer.String("\x01"));
|
||||||
|
EXPECT_FALSE(writer.String("\x1C"));
|
||||||
|
writer.EndArray();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Writer, ValidateEncoding) {
|
TEST(Writer, ValidateEncoding) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user