File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -291,6 +291,31 @@ func FuzzChainWriter(f *testing.F) {
291
291
})
292
292
}
293
293
294
+ var incompleteFrame = []struct {
295
+ name string
296
+ data []byte
297
+ }{
298
+ {
299
+ name : "Missing single byte" ,
300
+ data : []byte {0x02 },
301
+ },
302
+ {
303
+ name : "2 zeroes and missing end" ,
304
+ data : []byte {0x01 , 0x01 , 0x05 },
305
+ },
306
+ }
307
+
308
+ func TestDecodeIncomplete (t * testing.T ) {
309
+ for _ , tc := range incompleteFrame {
310
+ t .Run (tc .name , func (t * testing.T ) {
311
+ _ , err := Decode (tc .data )
312
+ if err != ErrIncompleteFrame {
313
+ t .Errorf ("Unexpected decode incomplete error: %v" , err )
314
+ }
315
+ })
316
+ }
317
+ }
318
+
294
319
// https://github.com/golang/go/issues/54111
295
320
type LimitedWriter struct {
296
321
W io.Writer // underlying writer
You can’t perform that action at this time.
0 commit comments