wind: Deny invalid UTF-8 encodings
Codepoints above U+10FFFF and overlong encodings are considered invalid. Unpaired surrogates are not, as these are known to be generated on occasion — by Windows, for example. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
This commit is contained in:
committed by
Nico Williams
parent
bf25b38c0a
commit
a3878d3e9d
@@ -50,21 +50,32 @@ static const char *failing_testcases[] = {
|
||||
"\xF7",
|
||||
"\xC0\x01",
|
||||
"\xC0\x7F",
|
||||
"\xC0\x80",
|
||||
"\xC0\x81",
|
||||
"\xC0\xFF",
|
||||
"\xC0\x80\x80",
|
||||
"\xC1\x80",
|
||||
"\xE0\x01",
|
||||
"\xE0\x7F",
|
||||
"\xE0\x80",
|
||||
"\xE0\xFF",
|
||||
"\xE0\x80\x20",
|
||||
"\xE0\x80\xFF",
|
||||
"\xE0\x80\x80",
|
||||
"\xE0\x80\x81",
|
||||
"\xE0\x80\x80\x80",
|
||||
"\xE0\x81\x80",
|
||||
"\xF0\x01",
|
||||
"\xF0\x80",
|
||||
"\xF0\x80\x01",
|
||||
"\xF0\x80\x80",
|
||||
"\xF0\x80\x80\x01",
|
||||
"\xF0\x80\x80\x80",
|
||||
"\xF0\x80\x80\x81",
|
||||
"\xF0\x80\x80\xFF",
|
||||
"\xF0\x80\x81\x80",
|
||||
"\xF0\x81\x80\x80",
|
||||
"\xF7\xBF\xBF\xBF",
|
||||
NULL
|
||||
};
|
||||
|
||||
@@ -82,21 +93,10 @@ static const struct testcase testcases[] = {
|
||||
{"\x01", 1, {1}, 0},
|
||||
{"\x7F", 1, {0x7F}, 0},
|
||||
{"\x01\x7F", 2, {0x01, 0x7F}, 0},
|
||||
{"\xC0\x80", 1, {0}, 0},
|
||||
{"\xC0\x81", 1, {1}, 0},
|
||||
{"\xC1\x80", 1, {0x40}, 0},
|
||||
{"\xDF\xBF", 1, {0x7FF}, 0},
|
||||
{"\xE0\x80\x80", 1, {0}, 0},
|
||||
{"\xE0\x80\x81", 1, {1}, 0},
|
||||
{"\xE0\x81\x80", 1, {0x40}, 0},
|
||||
{"\xE1\x80\x80", 1, {0x1000}, 0},
|
||||
{"\xEF\xBF\xBF", 1, {0xFFFF}, 0},
|
||||
{"\xF0\x80\x80\x80", 1, {0}, 0},
|
||||
{"\xF0\x80\x80\x81", 1, {1}, 0},
|
||||
{"\xF0\x80\x81\x80", 1, {0x40}, 0},
|
||||
{"\xF0\x81\x80\x80", 1, {0x1000}, 0},
|
||||
{"\xF1\x80\x80\x80", 1, {0x40000}, 0},
|
||||
{"\xF7\xBF\xBF\xBF", 1, {0X1FFFFF}, 1},
|
||||
};
|
||||
|
||||
int
|
||||
|
||||
Reference in New Issue
Block a user