Skip to content

Commit

Permalink
Fix invalid string conversion bug
Browse files Browse the repository at this point in the history
  • Loading branch information
markphelps committed Feb 20, 2022
1 parent c3f559b commit 81f01ac
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion internal/ext/fuzz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ func FuzzImport(f *testing.F) {

f.Fuzz(func(t *testing.T, in []byte) {
importer := NewImporter(&mockCreator{})
_ = importer.Import(context.Background(), bytes.NewReader(in))
if err := importer.Import(context.Background(), bytes.NewReader(in)); err != nil {
t.Skip()
}
})
}
4 changes: 3 additions & 1 deletion internal/ext/importer.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,9 @@ func convert(i interface{}) interface{} {
case map[interface{}]interface{}:
m := map[string]interface{}{}
for k, v := range x {
m[k.(string)] = convert(v)
if sk, ok := k.(string); ok {
m[sk] = convert(v)
}
}
return m
case []interface{}:
Expand Down

0 comments on commit 81f01ac

Please sign in to comment.