Imported Upstream version 2.5.11
[libapache-mod-security.git] / apache2 / t / tfn / escapeSeqDecode.t
1 ### Empty
2 {
3         type => "tfn",
4         name => "escapeSeqDecode",
5         input => "",
6         output => "",
7         ret => 0,
8 },
9
10 ### Nothing
11 {
12         type => "tfn",
13         name => "escapeSeqDecode",
14         input => "TestCase",
15         output => "TestCase",
16         ret => 0,
17 },
18 {
19         type => "tfn",
20         name => "escapeSeqDecode",
21         input => "Test\0Case",
22         output => "Test\0Case",
23         ret => 0,
24 },
25
26 ### Valid Sequences
27 {
28         type => "tfn",
29         name => "escapeSeqDecode",
30         input => "\\a\\b\\f\\n\\r\\t\\v\\?\\'\\\"\\0\\12\\123\\x00\\xff",
31         output => "\a\b\f\x0a\x0d\t\x0b?'\"\x00\x0a\x53\x00\xff",
32         ret => 1,
33 },
34 {
35         type => "tfn",
36         name => "escapeSeqDecode",
37         input => "\\a\\b\\f\\n\\r\\t\\v\0\\?\\'\\\"\\0\\12\\123\\x00\\xff",
38         output => "\a\b\f\x0a\x0d\t\x0b\0?'\"\x00\x0a\x53\x00\xff",
39         ret => 1,
40 },
41
42 ### Invalid Sequences
43 # \8 and \9 are not octal
44 # \666 is a byte overflow (0x1b6) and should be truncated to a byte as 0xb6
45 # \xag and \xga are not hex,
46 # \0123 is \012 + '3'
47 {
48         type => "tfn",
49         name => "escapeSeqDecode",
50         input => "\\8\\9\\666\\xag\\xga\\0123",
51         output => "89\xb6xagxga\x0a3",
52         ret => 1,
53 },
54
55 # \x, \x0 lack enough hex digits
56 {
57         type => "tfn",
58         name => "escapeSeqDecode",
59         input => "\\x",
60         output => "x",
61         ret => 1,
62 },
63 {
64         type => "tfn",
65         name => "escapeSeqDecode",
66         input => "\\x\\x0",
67         output => "xx0",
68         ret => 1,
69 },
70 {
71         type => "tfn",
72         name => "escapeSeqDecode",
73         input => "\\x\\x0\0",
74         output => "xx0\0",
75         ret => 1,
76 },
77 # Octal at end
78 {
79         type => "tfn",
80         name => "escapeSeqDecode",
81         input => "\\0",
82         output => "\x00",
83         ret => 1,
84 },
85 {
86         type => "tfn",
87         name => "escapeSeqDecode",
88         input => "\\01",
89         output => "\x01",
90         ret => 1,
91 },
92 {
93         type => "tfn",
94         name => "escapeSeqDecode",
95         input => "\\012",
96         output => "\x0a",
97         ret => 1,
98 },
99 # A forward slash with nothing after
100 {
101         type => "tfn",
102         name => "escapeSeqDecode",
103         input => "\\",
104         output => "\\",
105         ret => 0,
106 },
107 # A forward slash with NUL after
108 {
109         type => "tfn",
110         name => "escapeSeqDecode",
111         input => "\\\0",
112         output => "\0",
113         ret => 1,
114 },