Fuzzing setup and fixes (#755)
* encode: fix localdate formatting * encode: fix empty key marshaling * encode: fix invalid quotation of time.Time * encode: ensure control chars are escaped * decode: always use UTC for zero tz * encode: check for invalid characters in keys * encode: always construct map for empty array tables * fuzz: add go 1.18 fuzz test * encode: handle NaNs * encode: allow new lines in quoted keys * encode: never emit table inside array * encode: don't capitalize inf
This commit is contained in:
+4
-2
@@ -322,10 +322,12 @@ func (d *decoder) handleArrayTableCollectionLast(key ast.Iterator, v reflect.Val
|
||||
return v, nil
|
||||
case reflect.Slice:
|
||||
elemType := v.Type().Elem()
|
||||
var elem reflect.Value
|
||||
if elemType.Kind() == reflect.Interface {
|
||||
elemType = mapStringInterfaceType
|
||||
elem = makeMapStringInterface()
|
||||
} else {
|
||||
elem = reflect.New(elemType).Elem()
|
||||
}
|
||||
elem := reflect.New(elemType).Elem()
|
||||
elem2, err := d.handleArrayTable(key, elem)
|
||||
if err != nil {
|
||||
return reflect.Value{}, err
|
||||
|
||||
Reference in New Issue
Block a user