Added regression test case for bug 1525236 : utf8::is_valid does not detect overlong sequences
git-svn-id: http://svn.code.sf.net/p/utfcpp/code@12 a809a056-fc17-0410-9590-b4f493f8b08e
This commit is contained in:
parent
bc2f7ec37a
commit
93c5c6050d
2 changed files with 15 additions and 2 deletions
|
@ -51,10 +51,23 @@ check (!is_valid(udbff_dc00, udbff_dc00 + 6));
|
|||
unsigned char udbff_dfff[] = {0xed, 0xaf, 0xbf, 0xed, 0xbf, 0xbf};
|
||||
check (!is_valid(udbff_dfff, udbff_dfff + 6));
|
||||
|
||||
// Other illegal code positions
|
||||
// Other illegal code points
|
||||
unsigned char ufffe[] = {0xef, 0xbf, 0xbe};
|
||||
check (!is_valid(ufffe, ufffe + 3));
|
||||
|
||||
unsigned char uffff[] = {0xef, 0xbf, 0xbf};
|
||||
check (!is_valid(uffff, uffff + 3));
|
||||
}
|
||||
|
||||
// [ 1525236 ] utf8::is_valid does not detect overlong sequences
|
||||
void id_1525236 ()
|
||||
{
|
||||
unsigned char u2f_2bytes[] = {0xc0, 0xaf};
|
||||
check (!is_valid(u2f_2bytes, u2f_2bytes + 2));
|
||||
|
||||
unsigned char u2f_3bytes[] = {0xe0, 0x80, 0xaf};
|
||||
check (!is_valid(u2f_3bytes, u2f_3bytes + 3));
|
||||
|
||||
unsigned char u2f_4bytes[] = {0xf0, 0x80, 0x80, 0xaf};
|
||||
check (!is_valid(u2f_4bytes, u2f_4bytes + 4));
|
||||
}
|
||||
|
|
|
@ -16,5 +16,5 @@ int main()
|
|||
{
|
||||
//r1_0Beta1/invalidutf8.h
|
||||
id_1524459();
|
||||
|
||||
id_1525236();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue