-
Notifications
You must be signed in to change notification settings - Fork 53
/
fuzz_test.go
47 lines (42 loc) · 1.16 KB
/
fuzz_test.go
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
package goparquet
import (
"bytes"
"fmt"
"testing"
)
// this is meant to contain all unit tests that are testing crashers found through fuzz testing.
func TestFuzzThriftReadCrashes(t *testing.T) {
crashers := []string{
"PAR1)\xfa\xad\xa0\x93\xcd)000000000" +
"00000000000\x1b\x00\x00\x00PAR1",
"PAR1I\U000d7fd7\xef\xbf000000000" +
"0000000000\x1b\x00\x00\x00PAR1",
"PAR1I0t\x84\xd80\x010\x01'\x8a\x04\xd90\"\x01" +
"'\x8a\x04\xfc\x0300e0Re0r\t\x04\xf6�\xef" +
"\xbf0000000000000004\x00\x00\x00" +
"PAR1",
"PAR1)\xfa\xad\xa0\x93\xcd)000000000" +
"0000000000\x1b\x00\x00\x00PAR1",
"PAR1I\U000d7fd7\xef\xbf000000000" +
"00000000000\x1b\x00\x00\x00PAR1",
"PAR1I0t\x84\xd80\x010\x01'\x8a\x04\xd90\"\x01" +
"'\x8a\x04\xfc\x0300\x0400\xb9\f\x04\x040\xb9\xf3\xfb\xfb\xce" +
"\xb9\f000000000000004\x00\x00\x00" +
"PAR1",
}
for idx, data := range crashers {
t.Run(fmt.Sprintf("crasher%d", idx), func(t *testing.T) {
r, err := NewFileReader(bytes.NewReader([]byte(data)))
if err != nil {
t.Logf("NewFileReader failed: %v", err)
return
}
for {
_, err := r.NextRow()
if err != nil {
break
}
}
})
}
}