File: cssDecode.t

package info (click to toggle)
modsecurity-apache 2.9.3-1%2Bdeb10u1
  • links: PTS
  • area: main
  • in suites: buster
  • size: 10,348 kB
  • sloc: ansic: 51,287; sh: 4,516; perl: 2,340; cpp: 1,930; makefile: 605; xml: 6
file content (58 lines) | stat: -rw-r--r-- 1,062 bytes parent folder | download | duplicates (13)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
### Empty
{
	type => "tfn",
	name => "cssDecode",
	input => "",
	output => "",
	ret => 0,
},

### Nothing
{
	type => "tfn",
	name => "cssDecode",
	input => "TestCase",
	output => "TestCase",
	ret => 0,
},
{
	type => "tfn",
	name => "cssDecode",
	input => "Test\0Case",
	output => "Test\0Case",
	ret => 0,
},

### Valid Sequences
{
	type => "tfn",
	name => "cssDecode",
	input => "test\\a\\b\\f\\n\\r\\t\\v\\?\\'\\\"\\0\\12\\123\\1234\\12345\\123456\\ff01\\ff5e\\\n\\0  string",
	output => qq(test\x0a\x0b\x0fnrtv?'"\x00\x12\x23\x34\x45\x56\x21\x7e\x00 string),
	ret => 1,
},

### Invalid Sequences
# Trailing escape == line continuation with no line following (ie nothing)
{
	type => "tfn",
	name => "cssDecode",
	input => "test\\",
	output => "test",
	ret => 1,
},

# Edge cases
#  "\1A" == "\x1A"
#  "\1 A" == "\x01A"
#  "\1234567" == "\x567"
#  "\123456 7" == "\x567"
#  "\1x" == "\x01x"
#  "\1 x" == "\x01 x"
{
	type => "tfn",
	name => "cssDecode",
	input => "\\1A\\1 A\\1234567\\123456 7\\1x\\1 x",
	output => "\x1A\x01A\x567\x567\x01x\x01x",
	ret => 1,
},