Skip to content

Commit 9628217

Browse files
committed
more corner cases for internal encoder / decoder
1 parent 7a2bd2a commit 9628217

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#
2+
# Test vectors for internal protocol error conditions
3+
#
4+
proto internal
5+
proto-dictionary radius
6+
7+
#
8+
# ---- Insufficient data ----
9+
#
10+
11+
#
12+
# Only 1 byte - need at least 3 (enc_byte + type_field + len_field)
13+
#
14+
decode-pair 00
15+
match internal_decode_pair: Insufficient data. Need 2 additional byte(s)
16+
17+
#
18+
# ---- Encoding byte field overrun (large type/length fields) ----
19+
#
20+
21+
#
22+
# enc_byte = 0xe0: type_size=8, len_size=1, not extended
23+
# After enc_byte, 2 bytes remain but need 9 (8 + 1)
24+
#
25+
decode-pair e0 01 02
26+
match internal_decode_pair: Encoding byte invalid, fields overrun input data. 2 byte(s) remaining, need 9 byte(s)
27+
28+
#
29+
# enc_byte = 0xfc: type_size=8, len_size=8, not extended
30+
# After enc_byte, 2 bytes remain but need 16 (8 + 8)
31+
#
32+
decode-pair fc 01 02
33+
match internal_decode_pair: Encoding byte invalid, fields overrun input data. 2 byte(s) remaining, need 16 byte(s)
34+
35+
#
36+
# ---- Extension byte errors ----
37+
#
38+
39+
#
40+
# Third extension byte not in use - ext_byte has extended flag (bit 0) set
41+
# enc_byte = 0x01 (type_size=1, len_size=1, extended=true)
42+
# ext_byte = 0x01 (extended=true -> error)
43+
#
44+
decode-pair 01 01 01 00
45+
match internal_decode_pair: Third extension byte not in use
46+
47+
#
48+
# ---- Internal flag on non-root parent ----
49+
#
50+
51+
#
52+
# Internal flag can only be set on top level attribute
53+
# Outer: Vendor-Specific (attr 26), enc=0x00, type=0x1a, len=0x04
54+
# Inner: enc=0x01(extended), ext=0x40(internal), type=0x01, len=0x00
55+
# Parent is Vendor-Specific (not root, not group) -> error
56+
#
57+
decode-pair 00 1a 04 01 40 01 00
58+
match internal_decode_pair: Internal flag can only be set on top level attribute
59+
60+
count
61+
match 12

0 commit comments

Comments
 (0)