File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -131,6 +131,22 @@ int main(int argc, char *argv[])
131
131
len = tlv_span (wire , 0 , 1 , & start );
132
132
assert (start == 0 );
133
133
assert (len == strlen ("0010b8538094dbd70d8a0f0439d8e64f766f" ) / 2 );
134
+
135
+ /* Simulate an empty tlvstream */
136
+ wire = tal_arr (tmpctx , u8 , 0 );
137
+ len = tlv_span (wire , 0 , UINT64_MAX , & start );
138
+ assert (start == 0 );
139
+ assert (len == 0 );
140
+
141
+ /* Simulate a TLV stream where the payload is shorter
142
+ * than its length field indicates.
143
+ */
144
+ wire = tal_hexdata (tmpctx , "0502beef0a03de" , strlen ("0502beef0a03de" ));
145
+ len = tlv_span (wire , 0 , UINT64_MAX , & start );
146
+ assert (start == 0 );
147
+ /* The span should cover only the first valid record, which is 4 bytes long. */
148
+ assert (len == 4 );
149
+
134
150
common_shutdown ();
135
151
return 0 ;
136
152
}
You can’t perform that action at this time.
0 commit comments