Detect other invalid UTF-8 encodings
This commit is contained in:
1 parent
a0af8b0d7c
commit
7598c589fe
2 files changed
+29
-3
No files matched your search
+19
-1
@@ -40,11 +40,29 @@ unittest
|
||||
dcp = Testparser.Decoder.decode_code_point(input, input_length);
|
||||
assert(dcp == DCP(Testparser.Decoder.CODE_POINT_EOF, 0u));
|
||||
|
||||
inputstring = "\xf0\x9f\xa7\xa1";
|
||||
inputstring = "\xf0\x1f\x27\x21";
|
||||
input = cast(const(ubyte) *)inputstring.ptr;
|
||||
input_length = inputstring.length;
|
||||
dcp = Testparser.Decoder.decode_code_point(input, input_length);
|
||||
assert(dcp == DCP(0x1F9E1, 4u));
|
||||
|
||||
inputstring = "\xf0\x1f\x27";
|
||||
input = cast(const(ubyte) *)inputstring.ptr;
|
||||
input_length = inputstring.length;
|
||||
dcp = Testparser.Decoder.decode_code_point(input, input_length);
|
||||
assert(dcp == DCP(Testparser.Decoder.CODE_POINT_INVALID, 0u));
|
||||
|
||||
inputstring = "\xf0\x1f\x27\xFF";
|
||||
input = cast(const(ubyte) *)inputstring.ptr;
|
||||
input_length = inputstring.length;
|
||||
dcp = Testparser.Decoder.decode_code_point(input, input_length);
|
||||
assert(dcp == DCP(Testparser.Decoder.CODE_POINT_INVALID, 0u));
|
||||
|
||||
inputstring = "\xfe";
|
||||
input = cast(const(ubyte) *)inputstring.ptr;
|
||||
input_length = inputstring.length;
|
||||
dcp = Testparser.Decoder.decode_code_point(input, input_length);
|
||||
assert(dcp == DCP(Testparser.Decoder.CODE_POINT_INVALID, 0u));
|
||||
}
|
||||
|
||||
unittest
|
||||
|
||||
Reference in new issue
Block a user