From 2cb19ad9e60a9ad9bb7904fdb6b40b457125d3bb Mon Sep 17 00:00:00 2001 From: shamaton Date: Sun, 11 Sep 2022 18:00:17 +0900 Subject: [PATCH 1/9] fix case if unmarshal crashed data --- internal/decoding/bin.go | 20 +++++-- internal/decoding/complex.go | 70 ++++++++++++++++++----- internal/decoding/decoding.go | 15 +++-- internal/decoding/float.go | 25 +++++++-- internal/decoding/int.go | 55 ++++++++++++++---- internal/decoding/interface.go | 24 +++++++- internal/decoding/map.go | 15 ++++- internal/decoding/read.go | 31 +++++----- internal/decoding/slice.go | 15 ++++- internal/decoding/string.go | 28 ++++++--- internal/decoding/struct.go | 100 ++++++++++++++++++++++++++------- internal/decoding/uint.go | 55 ++++++++++++++---- 12 files changed, 352 insertions(+), 101 deletions(-) diff --git a/internal/decoding/bin.go b/internal/decoding/bin.go index 7855a77..7789640 100644 --- a/internal/decoding/bin.go +++ b/internal/decoding/bin.go @@ -17,20 +17,32 @@ func (d *decoder) isCodeBin(v byte) bool { } func (d *decoder) asBin(offset int, k reflect.Kind) ([]byte, int, error) { - code, offset := d.readSize1(offset) + code, offset, err := d.readSize1(offset) + if err != nil { + return emptyBytes, 0, err + } switch code { case def.Bin8: - l, offset := d.readSize1(offset) + l, offset, err := d.readSize1(offset) + if err != nil { + return emptyBytes, 0, err + } o := offset + int(uint8(l)) return d.data[offset:o], o, nil case def.Bin16: - bs, offset := d.readSize2(offset) + bs, offset, err := d.readSize2(offset) o := offset + int(binary.BigEndian.Uint16(bs)) + if err != nil { + return emptyBytes, 0, err + } return d.data[offset:o], o, nil case def.Bin32: - bs, offset := d.readSize4(offset) + bs, offset, err := d.readSize4(offset) o := offset + int(binary.BigEndian.Uint32(bs)) + if err != nil { + return emptyBytes, 0, err + } return d.data[offset:o], o, nil } diff --git a/internal/decoding/complex.go b/internal/decoding/complex.go index b5e5efc..819c82e 100644 --- a/internal/decoding/complex.go +++ b/internal/decoding/complex.go @@ -10,27 +10,48 @@ import ( ) func (d *decoder) asComplex64(offset int, k reflect.Kind) (complex64, int, error) { - code, offset := d.readSize1(offset) + code, offset, err := d.readSize1(offset) + if err != nil { + return complex(0, 0), 0, err + } switch code { case def.Fixext8: - t, offset := d.readSize1(offset) + t, offset, err := d.readSize1(offset) + if err != nil { + return complex(0, 0), 0, err + } if int8(t) != def.ComplexTypeCode() { return complex(0, 0), 0, fmt.Errorf("fixext8. complex type is diffrent %d, %d", t, def.ComplexTypeCode()) } - rb, offset := d.readSize4(offset) - ib, offset := d.readSize4(offset) + rb, offset, err := d.readSize4(offset) + if err != nil { + return complex(0, 0), 0, err + } + ib, offset, err := d.readSize4(offset) + if err != nil { + return complex(0, 0), 0, err + } r := math.Float32frombits(binary.BigEndian.Uint32(rb)) i := math.Float32frombits(binary.BigEndian.Uint32(ib)) return complex(r, i), offset, nil case def.Fixext16: - t, offset := d.readSize1(offset) + t, offset, err := d.readSize1(offset) + if err != nil { + return complex(0, 0), 0, err + } if int8(t) != def.ComplexTypeCode() { return complex(0, 0), 0, fmt.Errorf("fixext16. complex type is diffrent %d, %d", t, def.ComplexTypeCode()) } - rb, offset := d.readSize8(offset) - ib, offset := d.readSize8(offset) + rb, offset, err := d.readSize8(offset) + if err != nil { + return complex(0, 0), 0, err + } + ib, offset, err := d.readSize8(offset) + if err != nil { + return complex(0, 0), 0, err + } r := math.Float64frombits(binary.BigEndian.Uint64(rb)) i := math.Float64frombits(binary.BigEndian.Uint64(ib)) return complex64(complex(r, i)), offset, nil @@ -41,27 +62,48 @@ func (d *decoder) asComplex64(offset int, k reflect.Kind) (complex64, int, error } func (d *decoder) asComplex128(offset int, k reflect.Kind) (complex128, int, error) { - code, offset := d.readSize1(offset) + code, offset, err := d.readSize1(offset) + if err != nil { + return complex(0, 0), 0, err + } switch code { case def.Fixext8: - t, offset := d.readSize1(offset) + t, offset, err := d.readSize1(offset) + if err != nil { + return complex(0, 0), 0, err + } if int8(t) != def.ComplexTypeCode() { return complex(0, 0), 0, fmt.Errorf("fixext8. complex type is diffrent %d, %d", t, def.ComplexTypeCode()) } - rb, offset := d.readSize4(offset) - ib, offset := d.readSize4(offset) + rb, offset, err := d.readSize4(offset) + if err != nil { + return complex(0, 0), 0, err + } + ib, offset, err := d.readSize4(offset) + if err != nil { + return complex(0, 0), 0, err + } r := math.Float32frombits(binary.BigEndian.Uint32(rb)) i := math.Float32frombits(binary.BigEndian.Uint32(ib)) return complex128(complex(r, i)), offset, nil case def.Fixext16: - t, offset := d.readSize1(offset) + t, offset, err := d.readSize1(offset) + if err != nil { + return complex(0, 0), 0, err + } if int8(t) != def.ComplexTypeCode() { return complex(0, 0), 0, fmt.Errorf("fixext16. complex type is diffrent %d, %d", t, def.ComplexTypeCode()) } - rb, offset := d.readSize8(offset) - ib, offset := d.readSize8(offset) + rb, offset, err := d.readSize8(offset) + if err != nil { + return complex(0, 0), 0, err + } + ib, offset, err := d.readSize8(offset) + if err != nil { + return complex(0, 0), 0, err + } r := math.Float64frombits(binary.BigEndian.Uint64(rb)) i := math.Float64frombits(binary.BigEndian.Uint64(ib)) return complex(r, i), offset, nil diff --git a/internal/decoding/decoding.go b/internal/decoding/decoding.go index 9e4eebb..93a1a77 100644 --- a/internal/decoding/decoding.go +++ b/internal/decoding/decoding.go @@ -18,10 +18,9 @@ type decoder struct { func Decode(data []byte, v interface{}, asArray bool) error { d := decoder{data: data, asArray: asArray} - if d.data == nil { - return fmt.Errorf("data is nil") + if d.data == nil || len(d.data) < 1 { + return fmt.Errorf("data is emtpy") } - rv := reflect.ValueOf(v) if rv.Kind() != reflect.Ptr { return fmt.Errorf("holder must set pointer value. but got: %t", v) @@ -120,7 +119,10 @@ func (d *decoder) decode(rv reflect.Value, offset int) (int, error) { if err != nil { return 0, err } - bs, offset := d.asStringByteByLength(offset, l, k) + bs, offset, err := d.asStringByteByLength(offset, l, k) + if err != nil { + return 0, err + } rv.SetBytes(bs) return offset, nil } @@ -201,7 +203,10 @@ func (d *decoder) decode(rv reflect.Value, offset int) (int, error) { if l > rv.Len() { return 0, fmt.Errorf("%v len is %d, but msgpack has %d elements", rv.Type(), rv.Len(), l) } - bs, offset := d.asStringByteByLength(offset, l, k) + bs, offset, err := d.asStringByteByLength(offset, l, k) + if err != nil { + return 0, err + } for i, b := range bs { rv.Index(i).SetUint(uint64(b)) } diff --git a/internal/decoding/float.go b/internal/decoding/float.go index 3f3a93b..8483ba5 100644 --- a/internal/decoding/float.go +++ b/internal/decoding/float.go @@ -9,12 +9,18 @@ import ( ) func (d *decoder) asFloat32(offset int, k reflect.Kind) (float32, int, error) { - code := d.data[offset] + code, _, err := d.readSize1(offset) + if err != nil { + return 0, 0, err + } switch { case code == def.Float32: offset++ - bs, offset := d.readSize4(offset) + bs, offset, err := d.readSize4(offset) + if err != nil { + return 0, 0, err + } v := math.Float32frombits(binary.BigEndian.Uint32(bs)) return v, offset, nil @@ -40,18 +46,27 @@ func (d *decoder) asFloat32(offset int, k reflect.Kind) (float32, int, error) { } func (d *decoder) asFloat64(offset int, k reflect.Kind) (float64, int, error) { - code := d.data[offset] + code, _, err := d.readSize1(offset) + if err != nil { + return 0, 0, err + } switch { case code == def.Float64: offset++ - bs, offset := d.readSize8(offset) + bs, offset, err := d.readSize8(offset) + if err != nil { + return 0, 0, err + } v := math.Float64frombits(binary.BigEndian.Uint64(bs)) return v, offset, nil case code == def.Float32: offset++ - bs, offset := d.readSize4(offset) + bs, offset, err := d.readSize4(offset) + if err != nil { + return 0, 0, err + } v := math.Float32frombits(binary.BigEndian.Uint32(bs)) return float64(v), offset, nil diff --git a/internal/decoding/int.go b/internal/decoding/int.go index 04a0d8f..92967eb 100644 --- a/internal/decoding/int.go +++ b/internal/decoding/int.go @@ -17,59 +17,92 @@ func (d *decoder) isNegativeFixNum(v byte) bool { func (d *decoder) asInt(offset int, k reflect.Kind) (int64, int, error) { - code := d.data[offset] + code, _, err := d.readSize1(offset) + if err != nil { + return 0, 0, err + } switch { case d.isPositiveFixNum(code): - b, offset := d.readSize1(offset) + b, offset, err := d.readSize1(offset) + if err != nil { + return 0, 0, err + } return int64(b), offset, nil case d.isNegativeFixNum(code): - b, offset := d.readSize1(offset) + b, offset, err := d.readSize1(offset) + if err != nil { + return 0, 0, err + } return int64(int8(b)), offset, nil case code == def.Uint8: offset++ - b, offset := d.readSize1(offset) + b, offset, err := d.readSize1(offset) + if err != nil { + return 0, 0, err + } return int64(uint8(b)), offset, nil case code == def.Int8: offset++ - b, offset := d.readSize1(offset) + b, offset, err := d.readSize1(offset) + if err != nil { + return 0, 0, err + } return int64(int8(b)), offset, nil case code == def.Uint16: offset++ - bs, offset := d.readSize2(offset) + bs, offset, err := d.readSize2(offset) + if err != nil { + return 0, 0, err + } v := binary.BigEndian.Uint16(bs) return int64(v), offset, nil case code == def.Int16: offset++ - bs, offset := d.readSize2(offset) + bs, offset, err := d.readSize2(offset) + if err != nil { + return 0, 0, err + } v := int16(binary.BigEndian.Uint16(bs)) return int64(v), offset, nil case code == def.Uint32: offset++ - bs, offset := d.readSize4(offset) + bs, offset, err := d.readSize4(offset) + if err != nil { + return 0, 0, err + } v := binary.BigEndian.Uint32(bs) return int64(v), offset, nil case code == def.Int32: offset++ - bs, offset := d.readSize4(offset) + bs, offset, err := d.readSize4(offset) + if err != nil { + return 0, 0, err + } v := int32(binary.BigEndian.Uint32(bs)) return int64(v), offset, nil case code == def.Uint64: offset++ - bs, offset := d.readSize8(offset) + bs, offset, err := d.readSize8(offset) + if err != nil { + return 0, 0, err + } return int64(binary.BigEndian.Uint64(bs)), offset, nil case code == def.Int64: offset++ - bs, offset := d.readSize8(offset) + bs, offset, err := d.readSize8(offset) + if err != nil { + return 0, 0, err + } return int64(binary.BigEndian.Uint64(bs)), offset, nil case code == def.Float32: diff --git a/internal/decoding/interface.go b/internal/decoding/interface.go index fba11b3..e67bd7c 100644 --- a/internal/decoding/interface.go +++ b/internal/decoding/interface.go @@ -1,13 +1,17 @@ package decoding import ( + "fmt" "reflect" "github.com/shamaton/msgpack/v2/def" ) func (d *decoder) asInterface(offset int, k reflect.Kind) (interface{}, int, error) { - code := d.data[offset] + code, _, err := d.readSize1(offset) + if err != nil { + return 0, 0, err + } switch { case code == def.Nil: @@ -123,6 +127,9 @@ func (d *decoder) asInterface(offset int, k reflect.Kind) (interface{}, int, err } v := make(map[interface{}]interface{}, l) for i := 0; i < l; i++ { + if d.canSetAsMapKey(o) != nil { + return nil, 0, err + } key, o2, err := d.asInterface(o, k) if err != nil { return nil, 0, err @@ -158,6 +165,19 @@ func (d *decoder) asInterface(offset int, k reflect.Kind) (interface{}, int, err return v, offset, nil } } - return nil, 0, d.errorTemplate(code, k) } + +func (d *decoder) canSetAsMapKey(index int) error { + code, _, err := d.readSize1(index) + if err != nil { + return err + } + switch { + case d.isFixSlice(code), code == def.Array16, code == def.Array32: + return fmt.Errorf("can not use slice code for map key/ code: %x", code) + case d.isFixMap(code), code == def.Map16, code == def.Map32: + return fmt.Errorf("can not use map code for map key/ code: %x", code) + } + return nil +} diff --git a/internal/decoding/map.go b/internal/decoding/map.go index 34308d5..3e02804 100644 --- a/internal/decoding/map.go +++ b/internal/decoding/map.go @@ -59,16 +59,25 @@ func (d *decoder) isFixMap(v byte) bool { } func (d *decoder) mapLength(offset int, k reflect.Kind) (int, int, error) { - code, offset := d.readSize1(offset) + code, offset, err := d.readSize1(offset) + if err != nil { + return 0, 0, err + } switch { case d.isFixMap(code): return int(code - def.FixMap), offset, nil case code == def.Map16: - bs, offset := d.readSize2(offset) + bs, offset, err := d.readSize2(offset) + if err != nil { + return 0, 0, err + } return int(binary.BigEndian.Uint16(bs)), offset, nil case code == def.Map32: - bs, offset := d.readSize4(offset) + bs, offset, err := d.readSize4(offset) + if err != nil { + return 0, 0, err + } return int(binary.BigEndian.Uint32(bs)), offset, nil } return 0, 0, d.errorTemplate(code, k) diff --git a/internal/decoding/read.go b/internal/decoding/read.go index 4fd5e5b..5d976bc 100644 --- a/internal/decoding/read.go +++ b/internal/decoding/read.go @@ -1,29 +1,34 @@ package decoding import ( + "errors" + "github.com/shamaton/msgpack/v2/def" ) -func (d *decoder) readSize1(index int) (byte, int) { +func (d *decoder) readSize1(index int) (byte, int, error) { rb := def.Byte1 - return d.data[index], index + rb + if len(d.data) < index+rb { + return 0, 0, errors.New("too short bytes") + } + return d.data[index], index + rb, nil } -func (d *decoder) readSize2(index int) ([]byte, int) { - rb := def.Byte2 - return d.data[index : index+rb], index + rb +func (d *decoder) readSize2(index int) ([]byte, int, error) { + return d.readSizeN(index, def.Byte2) } -func (d *decoder) readSize4(index int) ([]byte, int) { - rb := def.Byte4 - return d.data[index : index+rb], index + rb +func (d *decoder) readSize4(index int) ([]byte, int, error) { + return d.readSizeN(index, def.Byte4) } -func (d *decoder) readSize8(index int) ([]byte, int) { - rb := def.Byte8 - return d.data[index : index+rb], index + rb +func (d *decoder) readSize8(index int) ([]byte, int, error) { + return d.readSizeN(index, def.Byte8) } -func (d *decoder) readSizeN(index, n int) ([]byte, int) { - return d.data[index : index+n], index + n +func (d *decoder) readSizeN(index, n int) ([]byte, int, error) { + if len(d.data) < index+n { + return emptyBytes, 0, errors.New("too short bytes") + } + return d.data[index : index+n], index + n, nil } diff --git a/internal/decoding/slice.go b/internal/decoding/slice.go index 1473952..a95fbc7 100644 --- a/internal/decoding/slice.go +++ b/internal/decoding/slice.go @@ -33,16 +33,25 @@ func (d *decoder) isFixSlice(v byte) bool { } func (d *decoder) sliceLength(offset int, k reflect.Kind) (int, int, error) { - code, offset := d.readSize1(offset) + code, offset, err := d.readSize1(offset) + if err != nil { + return 0, 0, err + } switch { case d.isFixSlice(code): return int(code - def.FixArray), offset, nil case code == def.Array16: - bs, offset := d.readSize2(offset) + bs, offset, err := d.readSize2(offset) + if err != nil { + return 0, 0, err + } return int(binary.BigEndian.Uint16(bs)), offset, nil case code == def.Array32: - bs, offset := d.readSize4(offset) + bs, offset, err := d.readSize4(offset) + if err != nil { + return 0, 0, err + } return int(binary.BigEndian.Uint32(bs)), offset, nil } return 0, 0, d.errorTemplate(code, k) diff --git a/internal/decoding/string.go b/internal/decoding/string.go index ae5a515..9aaf74d 100644 --- a/internal/decoding/string.go +++ b/internal/decoding/string.go @@ -19,20 +19,31 @@ func (d *decoder) isFixString(v byte) bool { } func (d *decoder) stringByteLength(offset int, k reflect.Kind) (int, int, error) { - code := d.data[offset] - offset++ + code, offset, err := d.readSize1(offset) + if err != nil { + return 0, 0, err + } if def.FixStr <= code && code <= def.FixStr+0x1f { l := int(code - def.FixStr) return l, offset, nil } else if code == def.Str8 { - b, offset := d.readSize1(offset) + b, offset, err := d.readSize1(offset) + if err != nil { + return 0, 0, err + } return int(b), offset, nil } else if code == def.Str16 { - b, offset := d.readSize2(offset) + b, offset, err := d.readSize2(offset) + if err != nil { + return 0, 0, err + } return int(binary.BigEndian.Uint16(b)), offset, nil } else if code == def.Str32 { - b, offset := d.readSize4(offset) + b, offset, err := d.readSize4(offset) + if err != nil { + return 0, 0, err + } return int(binary.BigEndian.Uint32(b)), offset, nil } else if code == def.Nil { return 0, offset, nil @@ -54,13 +65,12 @@ func (d *decoder) asStringByte(offset int, k reflect.Kind) ([]byte, int, error) return emptyBytes, 0, err } - b, o := d.asStringByteByLength(offset, l, k) - return b, o, nil + return d.asStringByteByLength(offset, l, k) } -func (d *decoder) asStringByteByLength(offset int, l int, k reflect.Kind) ([]byte, int) { +func (d *decoder) asStringByteByLength(offset int, l int, k reflect.Kind) ([]byte, int, error) { if l < 1 { - return emptyBytes, offset + return emptyBytes, offset, nil } return d.readSizeN(offset, l) diff --git a/internal/decoding/struct.go b/internal/decoding/struct.go index 2169d39..0e20561 100644 --- a/internal/decoding/struct.go +++ b/internal/decoding/struct.go @@ -83,7 +83,10 @@ func (d *decoder) setStructFromArray(rv reflect.Value, offset int, k reflect.Kin return 0, err } } else { - o = d.jumpOffset(o) + o, err = d.jumpOffset(o) + if err != nil { + return 0, err + } } } return o, nil @@ -141,15 +144,22 @@ func (d *decoder) setStructFromMap(rv reflect.Value, offset int, k reflect.Kind) return 0, err } } else { - o2 = d.jumpOffset(o2) + o2, err = d.jumpOffset(o2) + if err != nil { + return 0, err + } } o = o2 } return o, nil } -func (d *decoder) jumpOffset(offset int) int { - code, offset := d.readSize1(offset) +func (d *decoder) jumpOffset(offset int) (int, error) { + code, offset, err := d.readSize1(offset) + if err != nil { + return 0, err + } + switch { case code == def.True, code == def.False, code == def.Nil: // do nothing @@ -168,55 +178,94 @@ func (d *decoder) jumpOffset(offset int) int { case d.isFixString(code): offset += int(code - def.FixStr) case code == def.Str8, code == def.Bin8: - b, o := d.readSize1(offset) + b, o, err := d.readSize1(offset) + if err != nil { + return 0, err + } o += int(b) offset = o case code == def.Str16, code == def.Bin16: - bs, o := d.readSize2(offset) + bs, o, err := d.readSize2(offset) + if err != nil { + return 0, err + } o += int(binary.BigEndian.Uint16(bs)) offset = o case code == def.Str32, code == def.Bin32: - bs, o := d.readSize4(offset) + bs, o, err := d.readSize4(offset) + if err != nil { + return 0, err + } o += int(binary.BigEndian.Uint32(bs)) offset = o case d.isFixSlice(code): l := int(code - def.FixArray) for i := 0; i < l; i++ { - offset = d.jumpOffset(offset) + offset, err = d.jumpOffset(offset) + if err != nil { + return 0, err + } } case code == def.Array16: - bs, o := d.readSize2(offset) + bs, o, err := d.readSize2(offset) + if err != nil { + return 0, err + } l := int(binary.BigEndian.Uint16(bs)) for i := 0; i < l; i++ { - o = d.jumpOffset(o) + o, err = d.jumpOffset(o) + if err != nil { + return 0, err + } } offset = o case code == def.Array32: - bs, o := d.readSize4(offset) + bs, o, err := d.readSize4(offset) + if err != nil { + return 0, err + } l := int(binary.BigEndian.Uint32(bs)) for i := 0; i < l; i++ { - o = d.jumpOffset(o) + o, err = d.jumpOffset(o) + if err != nil { + return 0, err + } } offset = o case d.isFixMap(code): l := int(code - def.FixMap) for i := 0; i < l*2; i++ { - offset = d.jumpOffset(offset) + offset, err = d.jumpOffset(offset) + if err != nil { + return 0, err + } } case code == def.Map16: - bs, o := d.readSize2(offset) + bs, o, err := d.readSize2(offset) + if err != nil { + return 0, err + } l := int(binary.BigEndian.Uint16(bs)) for i := 0; i < l*2; i++ { - o = d.jumpOffset(o) + o, err = d.jumpOffset(o) + if err != nil { + return 0, err + } } offset = o case code == def.Map32: - bs, o := d.readSize4(offset) + bs, o, err := d.readSize4(offset) + if err != nil { + return 0, err + } l := int(binary.BigEndian.Uint32(bs)) for i := 0; i < l*2; i++ { - o = d.jumpOffset(o) + o, err = d.jumpOffset(o) + if err != nil { + return 0, err + } } offset = o @@ -232,18 +281,27 @@ func (d *decoder) jumpOffset(offset int) int { offset += def.Byte1 + def.Byte16 case code == def.Ext8: - b, o := d.readSize1(offset) + b, o, err := d.readSize1(offset) + if err != nil { + return 0, err + } o += def.Byte1 + int(b) offset = o case code == def.Ext16: - bs, o := d.readSize2(offset) + bs, o, err := d.readSize2(offset) + if err != nil { + return 0, err + } o += def.Byte1 + int(binary.BigEndian.Uint16(bs)) offset = o case code == def.Ext32: - bs, o := d.readSize4(offset) + bs, o, err := d.readSize4(offset) + if err != nil { + return 0, err + } o += def.Byte1 + int(binary.BigEndian.Uint32(bs)) offset = o } - return offset + return offset, nil } diff --git a/internal/decoding/uint.go b/internal/decoding/uint.go index 68df1c3..cd739fc 100644 --- a/internal/decoding/uint.go +++ b/internal/decoding/uint.go @@ -9,59 +9,92 @@ import ( func (d *decoder) asUint(offset int, k reflect.Kind) (uint64, int, error) { - code := d.data[offset] + code, _, err := d.readSize1(offset) + if err != nil { + return 0, 0, err + } switch { case d.isPositiveFixNum(code): - b, offset := d.readSize1(offset) + b, offset, err := d.readSize1(offset) + if err != nil { + return 0, 0, err + } return uint64(b), offset, nil case d.isNegativeFixNum(code): - b, offset := d.readSize1(offset) + b, offset, err := d.readSize1(offset) + if err != nil { + return 0, 0, err + } return uint64(int8(b)), offset, nil case code == def.Uint8: offset++ - b, offset := d.readSize1(offset) + b, offset, err := d.readSize1(offset) + if err != nil { + return 0, 0, err + } return uint64(uint8(b)), offset, nil case code == def.Int8: offset++ - b, offset := d.readSize1(offset) + b, offset, err := d.readSize1(offset) + if err != nil { + return 0, 0, err + } return uint64(int8(b)), offset, nil case code == def.Uint16: offset++ - bs, offset := d.readSize2(offset) + bs, offset, err := d.readSize2(offset) + if err != nil { + return 0, 0, err + } v := binary.BigEndian.Uint16(bs) return uint64(v), offset, nil case code == def.Int16: offset++ - bs, offset := d.readSize2(offset) + bs, offset, err := d.readSize2(offset) + if err != nil { + return 0, 0, err + } v := int16(binary.BigEndian.Uint16(bs)) return uint64(v), offset, nil case code == def.Uint32: offset++ - bs, offset := d.readSize4(offset) + bs, offset, err := d.readSize4(offset) + if err != nil { + return 0, 0, err + } v := binary.BigEndian.Uint32(bs) return uint64(v), offset, nil case code == def.Int32: offset++ - bs, offset := d.readSize4(offset) + bs, offset, err := d.readSize4(offset) + if err != nil { + return 0, 0, err + } v := int32(binary.BigEndian.Uint32(bs)) return uint64(v), offset, nil case code == def.Uint64: offset++ - bs, offset := d.readSize8(offset) + bs, offset, err := d.readSize8(offset) + if err != nil { + return 0, 0, err + } return binary.BigEndian.Uint64(bs), offset, nil case code == def.Int64: offset++ - bs, offset := d.readSize8(offset) + bs, offset, err := d.readSize8(offset) + if err != nil { + return 0, 0, err + } return binary.BigEndian.Uint64(bs), offset, nil case code == def.Nil: From 2e8fd17f59a8f13ef337ea517f8834f558aab899 Mon Sep 17 00:00:00 2001 From: shamaton Date: Sun, 11 Sep 2022 18:00:38 +0900 Subject: [PATCH 2/9] add test & testdata/crashers --- crash_test.go | 72 ++++++++++++++++++ .../007424b0caabdaf653d7efeb3ce6c1c127f628c6 | 1 + .../01d1844ec3cdec0e8d60d81fcded73f920270e9c | 1 + .../049b2af75fc4ee7160c7ea9bad41a5167b501d32 | 1 + .../051d081de15ae4680b4156046787aae72ae0adcc | 1 + .../063fea9d12105a80ee56a482aac428543fcf8d49 | 1 + .../080c57e02ab7e704e2a2e93aad7674a574dc9d69 | 1 + .../0d45579ce9ef9c1ca6e945d3f21ad31097f0c3c0 | 1 + .../0f7994b18fb75394c81005c925dd1ae153ad57ad | 1 + .../121a9af889bd4ca2266be5a4f680d3bead8d02d6 | 1 + .../19eb9972c2a406f15bbae850ac33b42ebd88f7a7 | 1 + .../1a3492dbf0b80d08f12ce49c620239e48b74c08c | 1 + .../1ae8bba51072f9ff2bdf587596cfb0edf8a5cd12 | 1 + .../1b274070ce90f8ccdf0fc33a4afd4e1455766f8b | 1 + .../1d49f1635e901393bf65a263810508bea7ec9d51 | 1 + .../1e2c5c5ac7754f3e3fd858ce644b6621da2f4d03 | 1 + .../236cfc19fdc31facdfe306e479a52bb3c08cb540 | 1 + .../2478b7ed4fe72f5030a22146ecf365adba0dc780 | 1 + .../24b5d7868ba6df6da0e26365e10fc15bcf72cca6 | 1 + .../255b827f8c0a593c5ee7610cdbd31c656f166a37 | 1 + .../2a8cbfc34aa4aefa008e9e18276e32fa5e8f56d8 | 1 + .../2ba0c664eff181eeb2b101f60c5ca66397f4c386 | 1 + .../2c34cfd27e783430e24c2af05361af3540b4d6ad | 1 + .../2c4dd5af849b5cda2b7769dc52706e5fa746de73 | 1 + .../2cdb9f5adf53f1054ce8e6ceba007396ce6b734b | 1 + .../30140397fe38ee61f01eff44b5cfa48285e47889 | 1 + .../321500ed9a1796dca3d559d8f129ed31a8790035 | 1 + .../3219e4d65ac8671a452900514bc3c7aea2e71be3 | 1 + .../36a5cc93968072de9d120643033589df4f316997 | 1 + .../3abe9a29f2b95f34da65d88b969e58f4b46b6309 | 1 + .../3e5a9e8b50fcdcbe08f8138de6b95b5cd5b69bf2 | 1 + .../3f0062c38d031b015f1a8bb82bd370b65d5ca35a | 1 + .../4670a8e0d21a624c0d42fd6dc76ef408d2b4e195 | 1 + .../47393c214b8f5a3d3c098e3985d24bd1e8d82a85 | 1 + .../48947b6f943721ce84ef81e887a16bde2759f7ab | 1 + .../49989f6a8875777519c822a92c821cbb95bfc360 | 1 + .../4aaffe149efbd0ab6f122a4dc6e9e9aa0a602799 | 1 + .../4b65bf83d9b292f65bb5d1b056d68a4811732ef3 | 1 + .../4c156cb396c967d81bf3615cbd5ba74221a9c622 | 1 + .../4fb8cfeaaac80a1c829b22a43089ef470bcfe5b8 | 1 + .../502804b3665c5eb935d6f66e7677f75242f516bb | 1 + .../56ff31c3b76d37929e45071a36ca5aa0bc386e09 | 1 + .../5bc56c0f00870625b5016a8d242ebe5c2a58802b | 1 + .../5e8c489081abe671d760e1840b526f43bc7e6aa3 | 1 + .../5ec02b6349403b523d33576c7e2de27fb345edf0 | 1 + .../6351ed5a9ac9cbb709ad15b4193edb52b8d37e84 | 1 + .../673480b070ea0508c3510627c81a4b519fb7d2f5 | 1 + .../683f06bff1a62b73193352f06a7194f0bf60ffb8 | 1 + .../68a5e75e9b42928454b320fe8f64ea107e61f60f | 1 + .../68be1e92e40e77926e1d9a5c2d800da023f6a4e9 | 1 + .../6b7395dabfc4d5a76e276f222c64c4bf7771ffb7 | 1 + .../707235f5352edef615d64d00d83fcf92c9dffa57 | 1 + .../71819c849b41ee2f4a5b08321b9fc8bf21326ddf | 1 + .../730377e1be92f426661e434d4f1cf20a10e16991 | 1 + .../73728d128f628772a64990a72340d9fd7987e29b | 1 + .../73cc8fe38acd489c2b1fed0a66222aac4e04cc98 | 1 + .../74fe2a4034b08b5ecb014b2596e7f21ab55ea729 | 1 + .../79aed363731b28a60abf16190df3d60fd1d88e54 | 1 + .../7a1d04a0253fbb956c8119c40dc917cb460dabb0 | 1 + .../7a96d469f87b8c0fa00a944669469db9c8246714 | 1 + .../7b21df3bb234142e7b2dfc81f84eb621f9c7a617 | 1 + .../7cd196c0e83037dd1c7aa060e3919f530d5eaa13 | Bin 0 -> 63 bytes .../8611c05469f8e623e1e035e578d1d50ff2a54e11 | 1 + .../861648845b817281bffa42d8ca1c46443cef5cd8 | 1 + .../86f9eb6ebcae33f4d3663f90adf430f6d7b5e57c | 1 + .../8a90278d26f66fd78e4e38da237c201707bf7ab3 | 1 + .../8de4d4284d8227a753986639b1d6e698bc683d8a | 1 + .../8e4cb24fea75d067b0d9a5598fdeb66490777000 | 1 + .../900843bfb3730b31165e6d480bb212854380de72 | Bin 0 -> 55 bytes .../964ac50bf26ecb3d0253e5e288484776bbf0abdf | 1 + .../98d2aa10f9c5e6d9b1a6fb3dcc6583aa5631882a | 1 + .../9ae8dabd9621f44592757414f83d26df04e55bca | 1 + .../9b982d96821f364683a7a9cc2495cccc7d5bb705 | 1 + .../9ded617601151e2a3dde370fe42f206f6dd38f42 | 1 + .../9e2487eee9a3b9f415c36aed893ed2da3d3bace6 | 1 + .../9f733d3115030339e63922d6e35920f9dba1207e | 1 + .../a0bb3eef10ad343fdf00adc2c7a2fab0e4dd679f | 1 + .../a611449daf97af318de6495f22c907ecb1f83076 | 1 + .../a8c1d81ff50e57abc043f8bbcc87ce0e123285a7 | 1 + .../aa1a1bd5b7953186af6c9f2e8f757247fdffa9ce | 1 + .../b7471e724dfba20b71265eb8f8315ff5add6ccad | 1 + .../b9df95e660f5bc5d66f2ad7c49339cb3d62d2a99 | 1 + .../bc22b685617fec260cb94cb1ab9822e393924a35 | 1 + .../c1a1ed4a1a749c9e38da920c66a4c425e169566b | 1 + .../c41c1a47577c69284cae60d785ddb240dc3739db | 1 + .../c4ee5a4632d4f9a51ba57a70cfa2cae832460857 | 1 + .../c9388db618e924f41e419ccddc068b443657ffa4 | 1 + .../ce7c29332788aa93186591aceaad307ffbdf9735 | 1 + .../da39a3ee5e6b4b0d3255bfef95601890afd80709 | 0 .../df0c1e8999119939ea4f07c2daeb57b868bb0719 | 1 + .../e2d6b6d4d9b8346067d2252bfbcefff99a24ed21 | 1 + .../e62ebb1ab82b8cf630f2b393d89c367dd0b25924 | 1 + .../e906f0d49a1b91f0b93d64c36bf5a764924ce45f | 1 + .../ead2a4908cb1750ae6f619656ebf74b153edab25 | 1 + .../eae5f62c3fc844275194f17d530d26ceafcf941b | 1 + .../eb9a0e5a353364b221b1e1e3115d34d7948e9ae9 | Bin 0 -> 51 bytes .../edb2dfda8124a5c5935dd1d449f493e868d9f9c0 | 1 + .../f023f3307ef4fe6b9d8ea2c0ea4fb3bc954f2888 | 1 + .../f1ec5f959e75412b01270a861f1f1ecdfda1cb9c | 1 + .../f4aaa2a22e1038e4abda4636592d330fc9fc693b | 1 + .../f7cb64ffc60ab1f9e0aecbd9c560af1d743fe314 | 1 + .../f86f8b65ecd59bddb8df4850b538b863021ea14a | 1 + .../f87f13e299cb66c824237b662a5623647d3af86e | 1 + .../fa85f6319c6d39864527629c9b25c4b086f398b7 | 1 + .../fc7077d7ef5f47af404835e9ea6401f258b27f83 | 1 + 105 files changed, 172 insertions(+) create mode 100644 crash_test.go create mode 100644 testdata/crashers/007424b0caabdaf653d7efeb3ce6c1c127f628c6 create mode 100644 testdata/crashers/01d1844ec3cdec0e8d60d81fcded73f920270e9c create mode 100644 testdata/crashers/049b2af75fc4ee7160c7ea9bad41a5167b501d32 create mode 100644 testdata/crashers/051d081de15ae4680b4156046787aae72ae0adcc create mode 100644 testdata/crashers/063fea9d12105a80ee56a482aac428543fcf8d49 create mode 100644 testdata/crashers/080c57e02ab7e704e2a2e93aad7674a574dc9d69 create mode 100644 testdata/crashers/0d45579ce9ef9c1ca6e945d3f21ad31097f0c3c0 create mode 100644 testdata/crashers/0f7994b18fb75394c81005c925dd1ae153ad57ad create mode 100644 testdata/crashers/121a9af889bd4ca2266be5a4f680d3bead8d02d6 create mode 100644 testdata/crashers/19eb9972c2a406f15bbae850ac33b42ebd88f7a7 create mode 100644 testdata/crashers/1a3492dbf0b80d08f12ce49c620239e48b74c08c create mode 100644 testdata/crashers/1ae8bba51072f9ff2bdf587596cfb0edf8a5cd12 create mode 100644 testdata/crashers/1b274070ce90f8ccdf0fc33a4afd4e1455766f8b create mode 100644 testdata/crashers/1d49f1635e901393bf65a263810508bea7ec9d51 create mode 100644 testdata/crashers/1e2c5c5ac7754f3e3fd858ce644b6621da2f4d03 create mode 100644 testdata/crashers/236cfc19fdc31facdfe306e479a52bb3c08cb540 create mode 100644 testdata/crashers/2478b7ed4fe72f5030a22146ecf365adba0dc780 create mode 100644 testdata/crashers/24b5d7868ba6df6da0e26365e10fc15bcf72cca6 create mode 100644 testdata/crashers/255b827f8c0a593c5ee7610cdbd31c656f166a37 create mode 100644 testdata/crashers/2a8cbfc34aa4aefa008e9e18276e32fa5e8f56d8 create mode 100644 testdata/crashers/2ba0c664eff181eeb2b101f60c5ca66397f4c386 create mode 100644 testdata/crashers/2c34cfd27e783430e24c2af05361af3540b4d6ad create mode 100644 testdata/crashers/2c4dd5af849b5cda2b7769dc52706e5fa746de73 create mode 100644 testdata/crashers/2cdb9f5adf53f1054ce8e6ceba007396ce6b734b create mode 100644 testdata/crashers/30140397fe38ee61f01eff44b5cfa48285e47889 create mode 100644 testdata/crashers/321500ed9a1796dca3d559d8f129ed31a8790035 create mode 100644 testdata/crashers/3219e4d65ac8671a452900514bc3c7aea2e71be3 create mode 100644 testdata/crashers/36a5cc93968072de9d120643033589df4f316997 create mode 100644 testdata/crashers/3abe9a29f2b95f34da65d88b969e58f4b46b6309 create mode 100644 testdata/crashers/3e5a9e8b50fcdcbe08f8138de6b95b5cd5b69bf2 create mode 100644 testdata/crashers/3f0062c38d031b015f1a8bb82bd370b65d5ca35a create mode 100644 testdata/crashers/4670a8e0d21a624c0d42fd6dc76ef408d2b4e195 create mode 100644 testdata/crashers/47393c214b8f5a3d3c098e3985d24bd1e8d82a85 create mode 100644 testdata/crashers/48947b6f943721ce84ef81e887a16bde2759f7ab create mode 100644 testdata/crashers/49989f6a8875777519c822a92c821cbb95bfc360 create mode 100644 testdata/crashers/4aaffe149efbd0ab6f122a4dc6e9e9aa0a602799 create mode 100644 testdata/crashers/4b65bf83d9b292f65bb5d1b056d68a4811732ef3 create mode 100644 testdata/crashers/4c156cb396c967d81bf3615cbd5ba74221a9c622 create mode 100644 testdata/crashers/4fb8cfeaaac80a1c829b22a43089ef470bcfe5b8 create mode 100644 testdata/crashers/502804b3665c5eb935d6f66e7677f75242f516bb create mode 100644 testdata/crashers/56ff31c3b76d37929e45071a36ca5aa0bc386e09 create mode 100644 testdata/crashers/5bc56c0f00870625b5016a8d242ebe5c2a58802b create mode 100644 testdata/crashers/5e8c489081abe671d760e1840b526f43bc7e6aa3 create mode 100644 testdata/crashers/5ec02b6349403b523d33576c7e2de27fb345edf0 create mode 100644 testdata/crashers/6351ed5a9ac9cbb709ad15b4193edb52b8d37e84 create mode 100644 testdata/crashers/673480b070ea0508c3510627c81a4b519fb7d2f5 create mode 100644 testdata/crashers/683f06bff1a62b73193352f06a7194f0bf60ffb8 create mode 100644 testdata/crashers/68a5e75e9b42928454b320fe8f64ea107e61f60f create mode 100644 testdata/crashers/68be1e92e40e77926e1d9a5c2d800da023f6a4e9 create mode 100644 testdata/crashers/6b7395dabfc4d5a76e276f222c64c4bf7771ffb7 create mode 100644 testdata/crashers/707235f5352edef615d64d00d83fcf92c9dffa57 create mode 100644 testdata/crashers/71819c849b41ee2f4a5b08321b9fc8bf21326ddf create mode 100644 testdata/crashers/730377e1be92f426661e434d4f1cf20a10e16991 create mode 100644 testdata/crashers/73728d128f628772a64990a72340d9fd7987e29b create mode 100644 testdata/crashers/73cc8fe38acd489c2b1fed0a66222aac4e04cc98 create mode 100644 testdata/crashers/74fe2a4034b08b5ecb014b2596e7f21ab55ea729 create mode 100644 testdata/crashers/79aed363731b28a60abf16190df3d60fd1d88e54 create mode 100644 testdata/crashers/7a1d04a0253fbb956c8119c40dc917cb460dabb0 create mode 100644 testdata/crashers/7a96d469f87b8c0fa00a944669469db9c8246714 create mode 100644 testdata/crashers/7b21df3bb234142e7b2dfc81f84eb621f9c7a617 create mode 100644 testdata/crashers/7cd196c0e83037dd1c7aa060e3919f530d5eaa13 create mode 100644 testdata/crashers/8611c05469f8e623e1e035e578d1d50ff2a54e11 create mode 100644 testdata/crashers/861648845b817281bffa42d8ca1c46443cef5cd8 create mode 100644 testdata/crashers/86f9eb6ebcae33f4d3663f90adf430f6d7b5e57c create mode 100644 testdata/crashers/8a90278d26f66fd78e4e38da237c201707bf7ab3 create mode 100644 testdata/crashers/8de4d4284d8227a753986639b1d6e698bc683d8a create mode 100644 testdata/crashers/8e4cb24fea75d067b0d9a5598fdeb66490777000 create mode 100644 testdata/crashers/900843bfb3730b31165e6d480bb212854380de72 create mode 100644 testdata/crashers/964ac50bf26ecb3d0253e5e288484776bbf0abdf create mode 100644 testdata/crashers/98d2aa10f9c5e6d9b1a6fb3dcc6583aa5631882a create mode 100644 testdata/crashers/9ae8dabd9621f44592757414f83d26df04e55bca create mode 100644 testdata/crashers/9b982d96821f364683a7a9cc2495cccc7d5bb705 create mode 100644 testdata/crashers/9ded617601151e2a3dde370fe42f206f6dd38f42 create mode 100644 testdata/crashers/9e2487eee9a3b9f415c36aed893ed2da3d3bace6 create mode 100644 testdata/crashers/9f733d3115030339e63922d6e35920f9dba1207e create mode 100644 testdata/crashers/a0bb3eef10ad343fdf00adc2c7a2fab0e4dd679f create mode 100644 testdata/crashers/a611449daf97af318de6495f22c907ecb1f83076 create mode 100644 testdata/crashers/a8c1d81ff50e57abc043f8bbcc87ce0e123285a7 create mode 100644 testdata/crashers/aa1a1bd5b7953186af6c9f2e8f757247fdffa9ce create mode 100644 testdata/crashers/b7471e724dfba20b71265eb8f8315ff5add6ccad create mode 100644 testdata/crashers/b9df95e660f5bc5d66f2ad7c49339cb3d62d2a99 create mode 100644 testdata/crashers/bc22b685617fec260cb94cb1ab9822e393924a35 create mode 100644 testdata/crashers/c1a1ed4a1a749c9e38da920c66a4c425e169566b create mode 100644 testdata/crashers/c41c1a47577c69284cae60d785ddb240dc3739db create mode 100644 testdata/crashers/c4ee5a4632d4f9a51ba57a70cfa2cae832460857 create mode 100644 testdata/crashers/c9388db618e924f41e419ccddc068b443657ffa4 create mode 100644 testdata/crashers/ce7c29332788aa93186591aceaad307ffbdf9735 create mode 100644 testdata/crashers/da39a3ee5e6b4b0d3255bfef95601890afd80709 create mode 100644 testdata/crashers/df0c1e8999119939ea4f07c2daeb57b868bb0719 create mode 100644 testdata/crashers/e2d6b6d4d9b8346067d2252bfbcefff99a24ed21 create mode 100644 testdata/crashers/e62ebb1ab82b8cf630f2b393d89c367dd0b25924 create mode 100644 testdata/crashers/e906f0d49a1b91f0b93d64c36bf5a764924ce45f create mode 100644 testdata/crashers/ead2a4908cb1750ae6f619656ebf74b153edab25 create mode 100644 testdata/crashers/eae5f62c3fc844275194f17d530d26ceafcf941b create mode 100644 testdata/crashers/eb9a0e5a353364b221b1e1e3115d34d7948e9ae9 create mode 100644 testdata/crashers/edb2dfda8124a5c5935dd1d449f493e868d9f9c0 create mode 100644 testdata/crashers/f023f3307ef4fe6b9d8ea2c0ea4fb3bc954f2888 create mode 100644 testdata/crashers/f1ec5f959e75412b01270a861f1f1ecdfda1cb9c create mode 100644 testdata/crashers/f4aaa2a22e1038e4abda4636592d330fc9fc693b create mode 100644 testdata/crashers/f7cb64ffc60ab1f9e0aecbd9c560af1d743fe314 create mode 100644 testdata/crashers/f86f8b65ecd59bddb8df4850b538b863021ea14a create mode 100644 testdata/crashers/f87f13e299cb66c824237b662a5623647d3af86e create mode 100644 testdata/crashers/fa85f6319c6d39864527629c9b25c4b086f398b7 create mode 100644 testdata/crashers/fc7077d7ef5f47af404835e9ea6401f258b27f83 diff --git a/crash_test.go b/crash_test.go new file mode 100644 index 0000000..f5ab514 --- /dev/null +++ b/crash_test.go @@ -0,0 +1,72 @@ +package msgpack_test + +import ( + "io" + "os" + "path/filepath" + "runtime" + "sync" + "testing" + + "github.com/shamaton/msgpack/v2" +) + +var crashDir = filepath.Join("testdata", "crashers") + +func TestCrashBinary(t *testing.T) { + entries, err := os.ReadDir(crashDir) + if err != nil { + t.Fatalf("os.ReadDir error. err: %+v", err) + } + + ch := make(chan string, len(entries)) + + // worker + wg := sync.WaitGroup{} + for i := 0; i < runtime.NumCPU(); i++ { + wg.Add(1) + go check(t, &wg, ch) + } + + for _, entry := range entries { + ch <- filepath.Join(crashDir, entry.Name()) + } + close(ch) + wg.Wait() +} + +func check(t *testing.T, wg *sync.WaitGroup, ch <-chan string) { + t.Helper() + defer wg.Done() + + for { + path, ok := <-ch // closeされると ok が false になる + if !ok { + return + } + + file, err := os.Open(path) + if err != nil { + t.Logf("%s file open error. err: %+v", path, err) + t.Fail() + return + } + + data, err := io.ReadAll(file) + if err != nil { + t.Logf("%s io.ReadAll error. err: %+v", path, err) + t.Fail() + return + } + + var r interface{} + err = msgpack.Unmarshal(data, &r) + if err == nil { + t.Logf("err should be occurred.\nname: %s\nlen: %d\nbin: % x", + file.Name(), len(data), data, + ) + t.Fail() + return + } + } +} diff --git a/testdata/crashers/007424b0caabdaf653d7efeb3ce6c1c127f628c6 b/testdata/crashers/007424b0caabdaf653d7efeb3ce6c1c127f628c6 new file mode 100644 index 0000000..1fe24ec --- /dev/null +++ b/testdata/crashers/007424b0caabdaf653d7efeb3ce6c1c127f628c6 @@ -0,0 +1 @@ +0000000 \ No newline at end of file diff --git a/testdata/crashers/01d1844ec3cdec0e8d60d81fcded73f920270e9c b/testdata/crashers/01d1844ec3cdec0e8d60d81fcded73f920270e9c new file mode 100644 index 0000000..7af9ef0 --- /dev/null +++ b/testdata/crashers/01d1844ec3cdec0e8d60d81fcded73f920270e9c @@ -0,0 +1 @@ +000000 \ No newline at end of file diff --git a/testdata/crashers/049b2af75fc4ee7160c7ea9bad41a5167b501d32 b/testdata/crashers/049b2af75fc4ee7160c7ea9bad41a5167b501d32 new file mode 100644 index 0000000..2927584 --- /dev/null +++ b/testdata/crashers/049b2af75fc4ee7160c7ea9bad41a5167b501d32 @@ -0,0 +1 @@ +000 \ No newline at end of file diff --git a/testdata/crashers/051d081de15ae4680b4156046787aae72ae0adcc b/testdata/crashers/051d081de15ae4680b4156046787aae72ae0adcc new file mode 100644 index 0000000..63ec430 --- /dev/null +++ b/testdata/crashers/051d081de15ae4680b4156046787aae72ae0adcc @@ -0,0 +1 @@ +0 \ No newline at end of file diff --git a/testdata/crashers/063fea9d12105a80ee56a482aac428543fcf8d49 b/testdata/crashers/063fea9d12105a80ee56a482aac428543fcf8d49 new file mode 100644 index 0000000..97955d1 --- /dev/null +++ b/testdata/crashers/063fea9d12105a80ee56a482aac428543fcf8d49 @@ -0,0 +1 @@ +0000000000000 \ No newline at end of file diff --git a/testdata/crashers/080c57e02ab7e704e2a2e93aad7674a574dc9d69 b/testdata/crashers/080c57e02ab7e704e2a2e93aad7674a574dc9d69 new file mode 100644 index 0000000..32004d5 --- /dev/null +++ b/testdata/crashers/080c57e02ab7e704e2a2e93aad7674a574dc9d69 @@ -0,0 +1 @@ +000000000 \ No newline at end of file diff --git a/testdata/crashers/0d45579ce9ef9c1ca6e945d3f21ad31097f0c3c0 b/testdata/crashers/0d45579ce9ef9c1ca6e945d3f21ad31097f0c3c0 new file mode 100644 index 0000000..9a37782 --- /dev/null +++ b/testdata/crashers/0d45579ce9ef9c1ca6e945d3f21ad31097f0c3c0 @@ -0,0 +1 @@ +0000000000000000000000000 \ No newline at end of file diff --git a/testdata/crashers/0f7994b18fb75394c81005c925dd1ae153ad57ad b/testdata/crashers/0f7994b18fb75394c81005c925dd1ae153ad57ad new file mode 100644 index 0000000..2c82c98 --- /dev/null +++ b/testdata/crashers/0f7994b18fb75394c81005c925dd1ae153ad57ad @@ -0,0 +1 @@ +000 \ No newline at end of file diff --git a/testdata/crashers/121a9af889bd4ca2266be5a4f680d3bead8d02d6 b/testdata/crashers/121a9af889bd4ca2266be5a4f680d3bead8d02d6 new file mode 100644 index 0000000..c471733 --- /dev/null +++ b/testdata/crashers/121a9af889bd4ca2266be5a4f680d3bead8d02d6 @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/testdata/crashers/19eb9972c2a406f15bbae850ac33b42ebd88f7a7 b/testdata/crashers/19eb9972c2a406f15bbae850ac33b42ebd88f7a7 new file mode 100644 index 0000000..cc50ba1 --- /dev/null +++ b/testdata/crashers/19eb9972c2a406f15bbae850ac33b42ebd88f7a7 @@ -0,0 +1 @@ +00000000000 \ No newline at end of file diff --git a/testdata/crashers/1a3492dbf0b80d08f12ce49c620239e48b74c08c b/testdata/crashers/1a3492dbf0b80d08f12ce49c620239e48b74c08c new file mode 100644 index 0000000..6303a4d --- /dev/null +++ b/testdata/crashers/1a3492dbf0b80d08f12ce49c620239e48b74c08c @@ -0,0 +1 @@ +0000000000 \ No newline at end of file diff --git a/testdata/crashers/1ae8bba51072f9ff2bdf587596cfb0edf8a5cd12 b/testdata/crashers/1ae8bba51072f9ff2bdf587596cfb0edf8a5cd12 new file mode 100644 index 0000000..8d5b991 --- /dev/null +++ b/testdata/crashers/1ae8bba51072f9ff2bdf587596cfb0edf8a5cd12 @@ -0,0 +1 @@ +0000000000000000000000000000000000000 \ No newline at end of file diff --git a/testdata/crashers/1b274070ce90f8ccdf0fc33a4afd4e1455766f8b b/testdata/crashers/1b274070ce90f8ccdf0fc33a4afd4e1455766f8b new file mode 100644 index 0000000..d812cf1 --- /dev/null +++ b/testdata/crashers/1b274070ce90f8ccdf0fc33a4afd4e1455766f8b @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/testdata/crashers/1d49f1635e901393bf65a263810508bea7ec9d51 b/testdata/crashers/1d49f1635e901393bf65a263810508bea7ec9d51 new file mode 100644 index 0000000..f77dfd6 --- /dev/null +++ b/testdata/crashers/1d49f1635e901393bf65a263810508bea7ec9d51 @@ -0,0 +1 @@ +00 \ No newline at end of file diff --git a/testdata/crashers/1e2c5c5ac7754f3e3fd858ce644b6621da2f4d03 b/testdata/crashers/1e2c5c5ac7754f3e3fd858ce644b6621da2f4d03 new file mode 100644 index 0000000..27c3e65 --- /dev/null +++ b/testdata/crashers/1e2c5c5ac7754f3e3fd858ce644b6621da2f4d03 @@ -0,0 +1 @@ +0000000000 \ No newline at end of file diff --git a/testdata/crashers/236cfc19fdc31facdfe306e479a52bb3c08cb540 b/testdata/crashers/236cfc19fdc31facdfe306e479a52bb3c08cb540 new file mode 100644 index 0000000..d10871d --- /dev/null +++ b/testdata/crashers/236cfc19fdc31facdfe306e479a52bb3c08cb540 @@ -0,0 +1 @@ +00000 \ No newline at end of file diff --git a/testdata/crashers/2478b7ed4fe72f5030a22146ecf365adba0dc780 b/testdata/crashers/2478b7ed4fe72f5030a22146ecf365adba0dc780 new file mode 100644 index 0000000..e4b32ae --- /dev/null +++ b/testdata/crashers/2478b7ed4fe72f5030a22146ecf365adba0dc780 @@ -0,0 +1 @@ +0000 \ No newline at end of file diff --git a/testdata/crashers/24b5d7868ba6df6da0e26365e10fc15bcf72cca6 b/testdata/crashers/24b5d7868ba6df6da0e26365e10fc15bcf72cca6 new file mode 100644 index 0000000..772e835 --- /dev/null +++ b/testdata/crashers/24b5d7868ba6df6da0e26365e10fc15bcf72cca6 @@ -0,0 +1 @@ +00 \ No newline at end of file diff --git a/testdata/crashers/255b827f8c0a593c5ee7610cdbd31c656f166a37 b/testdata/crashers/255b827f8c0a593c5ee7610cdbd31c656f166a37 new file mode 100644 index 0000000..4a8a6b2 --- /dev/null +++ b/testdata/crashers/255b827f8c0a593c5ee7610cdbd31c656f166a37 @@ -0,0 +1 @@ +00 \ No newline at end of file diff --git a/testdata/crashers/2a8cbfc34aa4aefa008e9e18276e32fa5e8f56d8 b/testdata/crashers/2a8cbfc34aa4aefa008e9e18276e32fa5e8f56d8 new file mode 100644 index 0000000..c14eb9a --- /dev/null +++ b/testdata/crashers/2a8cbfc34aa4aefa008e9e18276e32fa5e8f56d8 @@ -0,0 +1 @@ +0000 \ No newline at end of file diff --git a/testdata/crashers/2ba0c664eff181eeb2b101f60c5ca66397f4c386 b/testdata/crashers/2ba0c664eff181eeb2b101f60c5ca66397f4c386 new file mode 100644 index 0000000..06b17d1 --- /dev/null +++ b/testdata/crashers/2ba0c664eff181eeb2b101f60c5ca66397f4c386 @@ -0,0 +1 @@ +00000 \ No newline at end of file diff --git a/testdata/crashers/2c34cfd27e783430e24c2af05361af3540b4d6ad b/testdata/crashers/2c34cfd27e783430e24c2af05361af3540b4d6ad new file mode 100644 index 0000000..4f1e4f5 --- /dev/null +++ b/testdata/crashers/2c34cfd27e783430e24c2af05361af3540b4d6ad @@ -0,0 +1 @@ +0 \ No newline at end of file diff --git a/testdata/crashers/2c4dd5af849b5cda2b7769dc52706e5fa746de73 b/testdata/crashers/2c4dd5af849b5cda2b7769dc52706e5fa746de73 new file mode 100644 index 0000000..5fc16be --- /dev/null +++ b/testdata/crashers/2c4dd5af849b5cda2b7769dc52706e5fa746de73 @@ -0,0 +1 @@ +00 \ No newline at end of file diff --git a/testdata/crashers/2cdb9f5adf53f1054ce8e6ceba007396ce6b734b b/testdata/crashers/2cdb9f5adf53f1054ce8e6ceba007396ce6b734b new file mode 100644 index 0000000..bbc0271 --- /dev/null +++ b/testdata/crashers/2cdb9f5adf53f1054ce8e6ceba007396ce6b734b @@ -0,0 +1 @@ +00000000 \ No newline at end of file diff --git a/testdata/crashers/30140397fe38ee61f01eff44b5cfa48285e47889 b/testdata/crashers/30140397fe38ee61f01eff44b5cfa48285e47889 new file mode 100644 index 0000000..f327b9a --- /dev/null +++ b/testdata/crashers/30140397fe38ee61f01eff44b5cfa48285e47889 @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/testdata/crashers/321500ed9a1796dca3d559d8f129ed31a8790035 b/testdata/crashers/321500ed9a1796dca3d559d8f129ed31a8790035 new file mode 100644 index 0000000..0ce6c56 --- /dev/null +++ b/testdata/crashers/321500ed9a1796dca3d559d8f129ed31a8790035 @@ -0,0 +1 @@ +000000000000000000000 \ No newline at end of file diff --git a/testdata/crashers/3219e4d65ac8671a452900514bc3c7aea2e71be3 b/testdata/crashers/3219e4d65ac8671a452900514bc3c7aea2e71be3 new file mode 100644 index 0000000..3b0df7a --- /dev/null +++ b/testdata/crashers/3219e4d65ac8671a452900514bc3c7aea2e71be3 @@ -0,0 +1 @@ +00000000000000000000000000000 \ No newline at end of file diff --git a/testdata/crashers/36a5cc93968072de9d120643033589df4f316997 b/testdata/crashers/36a5cc93968072de9d120643033589df4f316997 new file mode 100644 index 0000000..45f9604 --- /dev/null +++ b/testdata/crashers/36a5cc93968072de9d120643033589df4f316997 @@ -0,0 +1 @@ +0000000000000000 \ No newline at end of file diff --git a/testdata/crashers/3abe9a29f2b95f34da65d88b969e58f4b46b6309 b/testdata/crashers/3abe9a29f2b95f34da65d88b969e58f4b46b6309 new file mode 100644 index 0000000..d4b9014 --- /dev/null +++ b/testdata/crashers/3abe9a29f2b95f34da65d88b969e58f4b46b6309 @@ -0,0 +1 @@ +0000000000000000000 \ No newline at end of file diff --git a/testdata/crashers/3e5a9e8b50fcdcbe08f8138de6b95b5cd5b69bf2 b/testdata/crashers/3e5a9e8b50fcdcbe08f8138de6b95b5cd5b69bf2 new file mode 100644 index 0000000..01468bc --- /dev/null +++ b/testdata/crashers/3e5a9e8b50fcdcbe08f8138de6b95b5cd5b69bf2 @@ -0,0 +1 @@ +00000000000000000 \ No newline at end of file diff --git a/testdata/crashers/3f0062c38d031b015f1a8bb82bd370b65d5ca35a b/testdata/crashers/3f0062c38d031b015f1a8bb82bd370b65d5ca35a new file mode 100644 index 0000000..637e8a0 --- /dev/null +++ b/testdata/crashers/3f0062c38d031b015f1a8bb82bd370b65d5ca35a @@ -0,0 +1 @@ +0000000000000000 \ No newline at end of file diff --git a/testdata/crashers/4670a8e0d21a624c0d42fd6dc76ef408d2b4e195 b/testdata/crashers/4670a8e0d21a624c0d42fd6dc76ef408d2b4e195 new file mode 100644 index 0000000..a45d4f2 --- /dev/null +++ b/testdata/crashers/4670a8e0d21a624c0d42fd6dc76ef408d2b4e195 @@ -0,0 +1 @@ +0 \ No newline at end of file diff --git a/testdata/crashers/47393c214b8f5a3d3c098e3985d24bd1e8d82a85 b/testdata/crashers/47393c214b8f5a3d3c098e3985d24bd1e8d82a85 new file mode 100644 index 0000000..81592f7 --- /dev/null +++ b/testdata/crashers/47393c214b8f5a3d3c098e3985d24bd1e8d82a85 @@ -0,0 +1 @@ +000000 \ No newline at end of file diff --git a/testdata/crashers/48947b6f943721ce84ef81e887a16bde2759f7ab b/testdata/crashers/48947b6f943721ce84ef81e887a16bde2759f7ab new file mode 100644 index 0000000..3f70eb9 --- /dev/null +++ b/testdata/crashers/48947b6f943721ce84ef81e887a16bde2759f7ab @@ -0,0 +1 @@ +000000000000000000000000000000000000 \ No newline at end of file diff --git a/testdata/crashers/49989f6a8875777519c822a92c821cbb95bfc360 b/testdata/crashers/49989f6a8875777519c822a92c821cbb95bfc360 new file mode 100644 index 0000000..dcd1a39 --- /dev/null +++ b/testdata/crashers/49989f6a8875777519c822a92c821cbb95bfc360 @@ -0,0 +1 @@ +000000000 \ No newline at end of file diff --git a/testdata/crashers/4aaffe149efbd0ab6f122a4dc6e9e9aa0a602799 b/testdata/crashers/4aaffe149efbd0ab6f122a4dc6e9e9aa0a602799 new file mode 100644 index 0000000..0a65cb8 --- /dev/null +++ b/testdata/crashers/4aaffe149efbd0ab6f122a4dc6e9e9aa0a602799 @@ -0,0 +1 @@ +00000000000000 \ No newline at end of file diff --git a/testdata/crashers/4b65bf83d9b292f65bb5d1b056d68a4811732ef3 b/testdata/crashers/4b65bf83d9b292f65bb5d1b056d68a4811732ef3 new file mode 100644 index 0000000..2b104ea --- /dev/null +++ b/testdata/crashers/4b65bf83d9b292f65bb5d1b056d68a4811732ef3 @@ -0,0 +1 @@ +0 \ No newline at end of file diff --git a/testdata/crashers/4c156cb396c967d81bf3615cbd5ba74221a9c622 b/testdata/crashers/4c156cb396c967d81bf3615cbd5ba74221a9c622 new file mode 100644 index 0000000..6ab04e2 --- /dev/null +++ b/testdata/crashers/4c156cb396c967d81bf3615cbd5ba74221a9c622 @@ -0,0 +1 @@ +NilBoolãIntМFloat32@IVFloat64 !oStringf \ No newline at end of file diff --git a/testdata/crashers/4fb8cfeaaac80a1c829b22a43089ef470bcfe5b8 b/testdata/crashers/4fb8cfeaaac80a1c829b22a43089ef470bcfe5b8 new file mode 100644 index 0000000..dd67376 --- /dev/null +++ b/testdata/crashers/4fb8cfeaaac80a1c829b22a43089ef470bcfe5b8 @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/testdata/crashers/502804b3665c5eb935d6f66e7677f75242f516bb b/testdata/crashers/502804b3665c5eb935d6f66e7677f75242f516bb new file mode 100644 index 0000000..5773bab --- /dev/null +++ b/testdata/crashers/502804b3665c5eb935d6f66e7677f75242f516bb @@ -0,0 +1 @@ +00000000000000000 \ No newline at end of file diff --git a/testdata/crashers/56ff31c3b76d37929e45071a36ca5aa0bc386e09 b/testdata/crashers/56ff31c3b76d37929e45071a36ca5aa0bc386e09 new file mode 100644 index 0000000..a130ad4 --- /dev/null +++ b/testdata/crashers/56ff31c3b76d37929e45071a36ca5aa0bc386e09 @@ -0,0 +1 @@ +0000000000000000000000000000000 \ No newline at end of file diff --git a/testdata/crashers/5bc56c0f00870625b5016a8d242ebe5c2a58802b b/testdata/crashers/5bc56c0f00870625b5016a8d242ebe5c2a58802b new file mode 100644 index 0000000..bdb4091 --- /dev/null +++ b/testdata/crashers/5bc56c0f00870625b5016a8d242ebe5c2a58802b @@ -0,0 +1 @@ +00000000000000000000000000 \ No newline at end of file diff --git a/testdata/crashers/5e8c489081abe671d760e1840b526f43bc7e6aa3 b/testdata/crashers/5e8c489081abe671d760e1840b526f43bc7e6aa3 new file mode 100644 index 0000000..9ccde19 --- /dev/null +++ b/testdata/crashers/5e8c489081abe671d760e1840b526f43bc7e6aa3 @@ -0,0 +1 @@ +000000000000000000000@IVFloat64 !oString \ No newline at end of file diff --git a/testdata/crashers/5ec02b6349403b523d33576c7e2de27fb345edf0 b/testdata/crashers/5ec02b6349403b523d33576c7e2de27fb345edf0 new file mode 100644 index 0000000..c4cb673 --- /dev/null +++ b/testdata/crashers/5ec02b6349403b523d33576c7e2de27fb345edf0 @@ -0,0 +1 @@ +0000 \ No newline at end of file diff --git a/testdata/crashers/6351ed5a9ac9cbb709ad15b4193edb52b8d37e84 b/testdata/crashers/6351ed5a9ac9cbb709ad15b4193edb52b8d37e84 new file mode 100644 index 0000000..de9f366 --- /dev/null +++ b/testdata/crashers/6351ed5a9ac9cbb709ad15b4193edb52b8d37e84 @@ -0,0 +1 @@ +0 \ No newline at end of file diff --git a/testdata/crashers/673480b070ea0508c3510627c81a4b519fb7d2f5 b/testdata/crashers/673480b070ea0508c3510627c81a4b519fb7d2f5 new file mode 100644 index 0000000..6a14659 --- /dev/null +++ b/testdata/crashers/673480b070ea0508c3510627c81a4b519fb7d2f5 @@ -0,0 +1 @@ +0 \ No newline at end of file diff --git a/testdata/crashers/683f06bff1a62b73193352f06a7194f0bf60ffb8 b/testdata/crashers/683f06bff1a62b73193352f06a7194f0bf60ffb8 new file mode 100644 index 0000000..c557c20 --- /dev/null +++ b/testdata/crashers/683f06bff1a62b73193352f06a7194f0bf60ffb8 @@ -0,0 +1 @@ +000000000000000000000 \ No newline at end of file diff --git a/testdata/crashers/68a5e75e9b42928454b320fe8f64ea107e61f60f b/testdata/crashers/68a5e75e9b42928454b320fe8f64ea107e61f60f new file mode 100644 index 0000000..23b99bc --- /dev/null +++ b/testdata/crashers/68a5e75e9b42928454b320fe8f64ea107e61f60f @@ -0,0 +1 @@ +000000 \ No newline at end of file diff --git a/testdata/crashers/68be1e92e40e77926e1d9a5c2d800da023f6a4e9 b/testdata/crashers/68be1e92e40e77926e1d9a5c2d800da023f6a4e9 new file mode 100644 index 0000000..aaea3d2 --- /dev/null +++ b/testdata/crashers/68be1e92e40e77926e1d9a5c2d800da023f6a4e9 @@ -0,0 +1 @@ +0000000000000000000000000 \ No newline at end of file diff --git a/testdata/crashers/6b7395dabfc4d5a76e276f222c64c4bf7771ffb7 b/testdata/crashers/6b7395dabfc4d5a76e276f222c64c4bf7771ffb7 new file mode 100644 index 0000000..53d5594 --- /dev/null +++ b/testdata/crashers/6b7395dabfc4d5a76e276f222c64c4bf7771ffb7 @@ -0,0 +1 @@ +00000000000 \ No newline at end of file diff --git a/testdata/crashers/707235f5352edef615d64d00d83fcf92c9dffa57 b/testdata/crashers/707235f5352edef615d64d00d83fcf92c9dffa57 new file mode 100644 index 0000000..32231ed --- /dev/null +++ b/testdata/crashers/707235f5352edef615d64d00d83fcf92c9dffa57 @@ -0,0 +1 @@ +00000000000000000000000000000000000000000000 \ No newline at end of file diff --git a/testdata/crashers/71819c849b41ee2f4a5b08321b9fc8bf21326ddf b/testdata/crashers/71819c849b41ee2f4a5b08321b9fc8bf21326ddf new file mode 100644 index 0000000..1ae1dd4 --- /dev/null +++ b/testdata/crashers/71819c849b41ee2f4a5b08321b9fc8bf21326ddf @@ -0,0 +1 @@ +0 \ No newline at end of file diff --git a/testdata/crashers/730377e1be92f426661e434d4f1cf20a10e16991 b/testdata/crashers/730377e1be92f426661e434d4f1cf20a10e16991 new file mode 100644 index 0000000..1fe5920 --- /dev/null +++ b/testdata/crashers/730377e1be92f426661e434d4f1cf20a10e16991 @@ -0,0 +1 @@ +00 \ No newline at end of file diff --git a/testdata/crashers/73728d128f628772a64990a72340d9fd7987e29b b/testdata/crashers/73728d128f628772a64990a72340d9fd7987e29b new file mode 100644 index 0000000..7040be7 --- /dev/null +++ b/testdata/crashers/73728d128f628772a64990a72340d9fd7987e29b @@ -0,0 +1 @@ +0 \ No newline at end of file diff --git a/testdata/crashers/73cc8fe38acd489c2b1fed0a66222aac4e04cc98 b/testdata/crashers/73cc8fe38acd489c2b1fed0a66222aac4e04cc98 new file mode 100644 index 0000000..d3d0ab9 --- /dev/null +++ b/testdata/crashers/73cc8fe38acd489c2b1fed0a66222aac4e04cc98 @@ -0,0 +1 @@ +00000000000000000000 \ No newline at end of file diff --git a/testdata/crashers/74fe2a4034b08b5ecb014b2596e7f21ab55ea729 b/testdata/crashers/74fe2a4034b08b5ecb014b2596e7f21ab55ea729 new file mode 100644 index 0000000..358bad5 --- /dev/null +++ b/testdata/crashers/74fe2a4034b08b5ecb014b2596e7f21ab55ea729 @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/testdata/crashers/79aed363731b28a60abf16190df3d60fd1d88e54 b/testdata/crashers/79aed363731b28a60abf16190df3d60fd1d88e54 new file mode 100644 index 0000000..62f9e6b --- /dev/null +++ b/testdata/crashers/79aed363731b28a60abf16190df3d60fd1d88e54 @@ -0,0 +1 @@ +00000 \ No newline at end of file diff --git a/testdata/crashers/7a1d04a0253fbb956c8119c40dc917cb460dabb0 b/testdata/crashers/7a1d04a0253fbb956c8119c40dc917cb460dabb0 new file mode 100644 index 0000000..ba3cc56 --- /dev/null +++ b/testdata/crashers/7a1d04a0253fbb956c8119c40dc917cb460dabb0 @@ -0,0 +1 @@ +NilBool£IntFloat32@IVFloat64 !oStri \ No newline at end of file diff --git a/testdata/crashers/7a96d469f87b8c0fa00a944669469db9c8246714 b/testdata/crashers/7a96d469f87b8c0fa00a944669469db9c8246714 new file mode 100644 index 0000000..ce6c200 --- /dev/null +++ b/testdata/crashers/7a96d469f87b8c0fa00a944669469db9c8246714 @@ -0,0 +1 @@ +000 \ No newline at end of file diff --git a/testdata/crashers/7b21df3bb234142e7b2dfc81f84eb621f9c7a617 b/testdata/crashers/7b21df3bb234142e7b2dfc81f84eb621f9c7a617 new file mode 100644 index 0000000..d293d34 --- /dev/null +++ b/testdata/crashers/7b21df3bb234142e7b2dfc81f84eb621f9c7a617 @@ -0,0 +1 @@ +000000000000 \ No newline at end of file diff --git a/testdata/crashers/7cd196c0e83037dd1c7aa060e3919f530d5eaa13 b/testdata/crashers/7cd196c0e83037dd1c7aa060e3919f530d5eaa13 new file mode 100644 index 0000000000000000000000000000000000000000..1e1ee20fb38913ca181377e5954db8dbaebd7d0f GIT binary patch literal 63 zcmZo$?3bByV2M+He$JuAo_X)47zI@&?Eh23u-q*tKe5Ev=#+yeUl@dAW^(!fr{bvt Q%|iLhf=h}r^U@ap0HN9(C;$Ke literal 0 HcmV?d00001 diff --git a/testdata/crashers/8611c05469f8e623e1e035e578d1d50ff2a54e11 b/testdata/crashers/8611c05469f8e623e1e035e578d1d50ff2a54e11 new file mode 100644 index 0000000..0fb5ff6 --- /dev/null +++ b/testdata/crashers/8611c05469f8e623e1e035e578d1d50ff2a54e11 @@ -0,0 +1 @@ +0000 \ No newline at end of file diff --git a/testdata/crashers/861648845b817281bffa42d8ca1c46443cef5cd8 b/testdata/crashers/861648845b817281bffa42d8ca1c46443cef5cd8 new file mode 100644 index 0000000..a38df5b --- /dev/null +++ b/testdata/crashers/861648845b817281bffa42d8ca1c46443cef5cd8 @@ -0,0 +1 @@ +000000000000000000000000000000000 \ No newline at end of file diff --git a/testdata/crashers/86f9eb6ebcae33f4d3663f90adf430f6d7b5e57c b/testdata/crashers/86f9eb6ebcae33f4d3663f90adf430f6d7b5e57c new file mode 100644 index 0000000..4fe9e94 --- /dev/null +++ b/testdata/crashers/86f9eb6ebcae33f4d3663f90adf430f6d7b5e57c @@ -0,0 +1 @@ +00000000000000000000000000000 \ No newline at end of file diff --git a/testdata/crashers/8a90278d26f66fd78e4e38da237c201707bf7ab3 b/testdata/crashers/8a90278d26f66fd78e4e38da237c201707bf7ab3 new file mode 100644 index 0000000..f0d5f50 --- /dev/null +++ b/testdata/crashers/8a90278d26f66fd78e4e38da237c201707bf7ab3 @@ -0,0 +1 @@ +0000 \ No newline at end of file diff --git a/testdata/crashers/8de4d4284d8227a753986639b1d6e698bc683d8a b/testdata/crashers/8de4d4284d8227a753986639b1d6e698bc683d8a new file mode 100644 index 0000000..a994237 --- /dev/null +++ b/testdata/crashers/8de4d4284d8227a753986639b1d6e698bc683d8a @@ -0,0 +1 @@ +000000000000000000000000000 \ No newline at end of file diff --git a/testdata/crashers/8e4cb24fea75d067b0d9a5598fdeb66490777000 b/testdata/crashers/8e4cb24fea75d067b0d9a5598fdeb66490777000 new file mode 100644 index 0000000..4f669ef --- /dev/null +++ b/testdata/crashers/8e4cb24fea75d067b0d9a5598fdeb66490777000 @@ -0,0 +1 @@ +000000000000000000000000000000000 \ No newline at end of file diff --git a/testdata/crashers/900843bfb3730b31165e6d480bb212854380de72 b/testdata/crashers/900843bfb3730b31165e6d480bb212854380de72 new file mode 100644 index 0000000000000000000000000000000000000000..aed5ac9ae5ce707c220074385e49c10ba83cfcc5 GIT binary patch literal 55 zcmV-70LcG_qfTjTz@$QNZ*0P&Np9|xGE#bAzx;Fnr$$K*R;Na6Z((#cG|RvVA Date: Sun, 11 Sep 2022 18:01:26 +0900 Subject: [PATCH 3/9] update test go version in Github Actions --- .github/workflows/test.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 025c169..fbf713c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,7 +7,6 @@ env: WORKSPACE: ${{ github.workspace }}/src/github.com/${{ github.repository }} jobs: - test: defaults: run: @@ -15,7 +14,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] - go: [1.13, 1.14, 1.15, 1.16] + go: [1.17, 1.18, 1.19] name: ${{ matrix.os }} @ Go ${{ matrix.go }} runs-on: ${{ matrix.os }} steps: @@ -44,7 +43,7 @@ jobs: run: go test -v --coverpkg=github.com/shamaton/msgpack/... --coverprofile=coverage.coverprofile --covermode=atomic ./... - name: Upload coverage to Codecov - if: success() && matrix.go == 1.15 && matrix.os == 'ubuntu-latest' + if: success() && matrix.go == 1.19 && matrix.os == 'ubuntu-latest' uses: codecov/codecov-action@v1 with: token: From 0f57acc3515d4628123e4097334ee383a6a0de8e Mon Sep 17 00:00:00 2001 From: shamaton Date: Sun, 11 Sep 2022 18:12:59 +0900 Subject: [PATCH 4/9] print if panic occured --- crash_test.go | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/crash_test.go b/crash_test.go index f5ab514..1f98b67 100644 --- a/crash_test.go +++ b/crash_test.go @@ -36,11 +36,23 @@ func TestCrashBinary(t *testing.T) { } func check(t *testing.T, wg *sync.WaitGroup, ch <-chan string) { + var ( + path string + ok bool + data []byte + ) t.Helper() defer wg.Done() + defer func() { + if e := recover(); e != nil { + t.Logf("panic occurred.\nfile: %s\nlen: %d\nbin: % x\nerr: %+v", + path, len(data), data, e, + ) + } + }() for { - path, ok := <-ch // closeされると ok が false になる + path, ok = <-ch // closeされると ok が false になる if !ok { return } @@ -68,5 +80,8 @@ func check(t *testing.T, wg *sync.WaitGroup, ch <-chan string) { t.Fail() return } + + path = "" + data = nil } } From 2e916baa22142a288b4581a411726279492ab244 Mon Sep 17 00:00:00 2001 From: shamaton Date: Wed, 19 Oct 2022 21:52:28 +0900 Subject: [PATCH 5/9] check required data size --- internal/decoding/decoding.go | 12 ++++++++++++ internal/decoding/interface.go | 7 +++++++ internal/decoding/map.go | 10 ++++++++++ internal/decoding/slice.go | 9 +++++++++ internal/decoding/struct.go | 8 ++++++++ 5 files changed, 46 insertions(+) diff --git a/internal/decoding/decoding.go b/internal/decoding/decoding.go index 93a1a77..eb9261d 100644 --- a/internal/decoding/decoding.go +++ b/internal/decoding/decoding.go @@ -133,6 +133,10 @@ func (d *decoder) decode(rv reflect.Value, offset int) (int, error) { return 0, err } + if err = d.hasRequiredLeastSliceSize(o, l); err != nil { + return 0, err + } + // check fixed type fixedOffset, found, err := d.asFixedSlice(rv, o, l) if err != nil { @@ -223,6 +227,10 @@ func (d *decoder) decode(rv reflect.Value, offset int) (int, error) { return 0, fmt.Errorf("%v len is %d, but msgpack has %d elements", rv.Type(), rv.Len(), l) } + if err = d.hasRequiredLeastSliceSize(o, l); err != nil { + return 0, err + } + // create array dynamically for i := 0; i < l; i++ { o, err = d.decode(rv.Index(i), o) @@ -245,6 +253,10 @@ func (d *decoder) decode(rv reflect.Value, offset int) (int, error) { return 0, err } + if err = d.hasRequiredLeastMapSize(o, l); err != nil { + return 0, err + } + // check fixed type fixedOffset, found, err := d.asFixedMap(rv, o, l) if err != nil { diff --git a/internal/decoding/interface.go b/internal/decoding/interface.go index e67bd7c..537ac3f 100644 --- a/internal/decoding/interface.go +++ b/internal/decoding/interface.go @@ -108,6 +108,10 @@ func (d *decoder) asInterface(offset int, k reflect.Kind) (interface{}, int, err return nil, 0, err } + if err = d.hasRequiredLeastSliceSize(o, l); err != nil { + return nil, 0, err + } + v := make([]interface{}, l) for i := 0; i < l; i++ { vv, o2, err := d.asInterface(o, k) @@ -125,6 +129,9 @@ func (d *decoder) asInterface(offset int, k reflect.Kind) (interface{}, int, err if err != nil { return nil, 0, err } + if err = d.hasRequiredLeastMapSize(o, l); err != nil { + return nil, 0, err + } v := make(map[interface{}]interface{}, l) for i := 0; i < l; i++ { if d.canSetAsMapKey(o) != nil { diff --git a/internal/decoding/map.go b/internal/decoding/map.go index 3e02804..2f2d52c 100644 --- a/internal/decoding/map.go +++ b/internal/decoding/map.go @@ -2,6 +2,7 @@ package decoding import ( "encoding/binary" + "errors" "reflect" "github.com/shamaton/msgpack/v2/def" @@ -80,9 +81,18 @@ func (d *decoder) mapLength(offset int, k reflect.Kind) (int, int, error) { } return int(binary.BigEndian.Uint32(bs)), offset, nil } + return 0, 0, d.errorTemplate(code, k) } +func (d *decoder) hasRequiredLeastMapSize(offset, length int) error { + // minimum check (byte length) + if len(d.data[offset:]) < length*2 { + return errors.New("data length lacks to create map") + } + return nil +} + func (d *decoder) asFixedMap(rv reflect.Value, offset int, l int) (int, bool, error) { t := rv.Type() diff --git a/internal/decoding/slice.go b/internal/decoding/slice.go index a95fbc7..12a86fa 100644 --- a/internal/decoding/slice.go +++ b/internal/decoding/slice.go @@ -2,6 +2,7 @@ package decoding import ( "encoding/binary" + "errors" "reflect" "github.com/shamaton/msgpack/v2/def" @@ -57,6 +58,14 @@ func (d *decoder) sliceLength(offset int, k reflect.Kind) (int, int, error) { return 0, 0, d.errorTemplate(code, k) } +func (d *decoder) hasRequiredLeastSliceSize(offset, length int) error { + // minimum check (byte length) + if len(d.data[offset:]) < length { + return errors.New("data length lacks to create map") + } + return nil +} + func (d *decoder) asFixedSlice(rv reflect.Value, offset int, l int) (int, bool, error) { t := rv.Type() k := t.Elem().Kind() diff --git a/internal/decoding/struct.go b/internal/decoding/struct.go index 0e20561..6f39f33 100644 --- a/internal/decoding/struct.go +++ b/internal/decoding/struct.go @@ -61,6 +61,10 @@ func (d *decoder) setStructFromArray(rv reflect.Value, offset int, k reflect.Kin return 0, err } + if err = d.hasRequiredLeastSliceSize(o, l); err != nil { + return 0, err + } + // find or create reference var scta *structCacheTypeArray cache, findCache := mapSCTA.Load(rv.Type()) @@ -99,6 +103,10 @@ func (d *decoder) setStructFromMap(rv reflect.Value, offset int, k reflect.Kind) return 0, err } + if err = d.hasRequiredLeastMapSize(o, l); err != nil { + return 0, err + } + var sctm *structCacheTypeMap cache, cacheFind := mapSCTM.Load(rv.Type()) if !cacheFind { From 398a5c841cc3c70117ae3416f12253a8db618ec0 Mon Sep 17 00:00:00 2001 From: shamaton Date: Thu, 20 Oct 2022 22:25:18 +0900 Subject: [PATCH 6/9] update test actions components --- .github/workflows/test.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fbf713c..a06164c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,12 +19,12 @@ jobs: runs-on: ${{ matrix.os }} steps: - name: Set up Go ${{ matrix.go }} - uses: actions/setup-go@v2 + uses: actions/setup-go@v3 with: go-version: ${{ matrix.go }} - name: Cache - uses: actions/cache@v2.1.0 + uses: actions/cache@v3 with: path: ~/go/pkg/mod key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} @@ -32,7 +32,7 @@ jobs: ${{ runner.os }}-go- - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: path: ${{ env.WORKSPACE }} @@ -55,11 +55,10 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: path: ${{ env.WORKSPACE }} - name: golangci-lint - uses: golangci/golangci-lint-action@v2 + uses: reviewdog/action-golangci-lint@v2 with: - version: v1.29 - working-directory: ${{ env.WORKSPACE }} + workdir: ${{ env.WORKSPACE }} From 290d27fdfa49aae8be5abed93cbfdcbe51b1b1ed Mon Sep 17 00:00:00 2001 From: shamaton Date: Thu, 20 Oct 2022 22:38:34 +0900 Subject: [PATCH 7/9] set github-pr-review option --- .github/workflows/test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a06164c..36660a9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -62,3 +62,5 @@ jobs: uses: reviewdog/action-golangci-lint@v2 with: workdir: ${{ env.WORKSPACE }} + level: warning + reporter: github-pr-review From 04898e65545aca689a7926dbac989f95d1909d61 Mon Sep 17 00:00:00 2001 From: shamaton Date: Thu, 20 Oct 2022 22:39:22 +0900 Subject: [PATCH 8/9] fix typo --- internal/decoding/decoding.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/decoding/decoding.go b/internal/decoding/decoding.go index eb9261d..a1b064d 100644 --- a/internal/decoding/decoding.go +++ b/internal/decoding/decoding.go @@ -19,7 +19,7 @@ func Decode(data []byte, v interface{}, asArray bool) error { d := decoder{data: data, asArray: asArray} if d.data == nil || len(d.data) < 1 { - return fmt.Errorf("data is emtpy") + return fmt.Errorf("data is empty") } rv := reflect.ValueOf(v) if rv.Kind() != reflect.Ptr { From c4edbe52d6261f5155cf54972585a33e6013723a Mon Sep 17 00:00:00 2001 From: shamaton Date: Thu, 20 Oct 2022 22:47:34 +0900 Subject: [PATCH 9/9] fix ineffassign --- crash_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crash_test.go b/crash_test.go index 1f98b67..0bcc67d 100644 --- a/crash_test.go +++ b/crash_test.go @@ -64,7 +64,7 @@ func check(t *testing.T, wg *sync.WaitGroup, ch <-chan string) { return } - data, err := io.ReadAll(file) + data, err = io.ReadAll(file) if err != nil { t.Logf("%s io.ReadAll error. err: %+v", path, err) t.Fail()