Mobiusi commited on
Commit
b550ed4
·
verified ·
1 Parent(s): ad2699b

sync sample package

Browse files
record_044e169a-c88b-4446-a5a3-7c00eb743c0d.json ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "evidence": "For this input, the buffer has 7 octets and the declared payload length is 4, so len(data) < length is false. The subsequent slice returns only three payload octets instead of rejecting the IE.",
3
+ "test_case": {
4
+ "protocol_name": "PFCP (N4)",
5
+ "message_type": "Recovery Time Stamp IE",
6
+ "encoded_message_hex": "00600004010203",
7
+ "test_condition": "The IE header declares a four-octet value, but only three value octets follow the header.",
8
+ "expected_behavior": "Reject the IE because the available value is shorter than the declared length; do not return a partial value."
9
+ },
10
+ "source_code": "def parse_ie(data):\n ie_type = int.from_bytes(data[0:2], 'big')\n length = int.from_bytes(data[2:4], 'big')\n if len(data) < length:\n raise ValueError('truncated IE')\n return ie_type, data[4:4 + length]\n",
11
+ "bug_root_cause": "The truncation check compares the total buffer length with the payload length, without accounting for the four-octet IE header. As a result, a short payload can pass the check.",
12
+ "defect_category": "长度处理错误",
13
+ "validation_result": "失败",
14
+ "affected_information_element": "Recovery Time Stamp IE value"
15
+ }
record_7d1ad049-100c-466d-b857-a9a103c4c853.json ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "defect_category": "可选字段处理错误",
3
+ "validation_result": "失败",
4
+ "affected_information_element": "F-SEID IPv4 and IPv6 address fields",
5
+ "evidence": "The input flags octet is 0x02. The condition flags & 0x03 therefore reads the first four IPv6 octets as IPv4, leaving only twelve octets for the subsequent IPv6 conversion, which requires sixteen.",
6
+ "test_case": {
7
+ "protocol_name": "PFCP (N4)",
8
+ "message_type": "F-SEID IE",
9
+ "encoded_message_hex": "0039001902010203040506070820010db8000000000000000000000001",
10
+ "test_condition": "The F-SEID flags indicate IPv6 is present and IPv4 is absent; the value contains a SEID followed by a 16-octet IPv6 address.",
11
+ "expected_behavior": "Parse the SEID and IPv6 address 2001:db8::1, leave the IPv4 address absent, and consume the entire IE value."
12
+ },
13
+ "source_code": "import ipaddress\n\ndef parse_fseid(data):\n if len(data) < 4:\n raise ValueError('truncated IE header')\n ie_type = int.from_bytes(data[0:2], 'big')\n if ie_type != 57:\n raise ValueError('unexpected IE type')\n length = int.from_bytes(data[2:4], 'big')\n value = data[4:4 + length]\n if len(value) != length or len(value) < 9:\n raise ValueError('truncated F-SEID')\n flags = value[0]\n seid = int.from_bytes(value[1:9], 'big')\n offset = 9\n ipv4 = None\n ipv6 = None\n if flags & 0x03:\n ipv4 = ipaddress.IPv4Address(value[offset:offset + 4])\n offset += 4\n if flags & 0x02:\n ipv6 = ipaddress.IPv6Address(value[offset:offset + 16])\n offset += 16\n if offset != len(value):\n raise ValueError('unexpected F-SEID length')\n return seid, ipv4, ipv6\n",
14
+ "bug_root_cause": "The IPv4 presence check uses mask 0x03, which is set when either the IPv4 or IPv6 flag is present. It should test only the IPv4 flag, so an IPv6-only value is incorrectly consumed as if it included IPv4."
15
+ }
record_d276d777-5275-4d46-b846-e73b80d52b29.json ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "evidence": "With input 0060, the length slice data[2:4] is empty and int.from_bytes returns zero. The code then returns an IE with an empty value instead of rejecting the incomplete header.",
3
+ "test_case": {
4
+ "protocol_name": "PFCP (N4)",
5
+ "message_type": "Generic PFCP IE header",
6
+ "encoded_message_hex": "0060",
7
+ "test_condition": "The input ends after the two-octet IE type and contains neither octet of the required length field.",
8
+ "expected_behavior": "Reject the input as a truncated IE header before interpreting a length or returning an IE value."
9
+ },
10
+ "source_code": "def parse_ie(data):\n if len(data) < 2:\n raise ValueError('missing IE type')\n ie_type = int.from_bytes(data[0:2], 'big')\n length = int.from_bytes(data[2:4], 'big')\n value = data[4:4 + length]\n if len(value) != length:\n raise ValueError('truncated IE value')\n return ie_type, value\n",
11
+ "bug_root_cause": "The initial boundary check verifies only that the two-octet IE type is present. It does not require the complete four-octet IE header before reading the length field.",
12
+ "defect_category": "边界条件处理错误",
13
+ "validation_result": "失败",
14
+ "affected_information_element": "PFCP IE length field"
15
+ }