Skip to content

values of type "[][]byte" are lost when marshalling #286

@rickyyangz

Description

@rickyyangz

The latest PR (#283) introduced a bug that as the title described. So multidimensional byte slices/arrays will be marshalled to empty bytes.

I wrote a testcase

func TestMultidimensionalByteSlice(t *testing.T) {
    arr := [2][2]byte{
        [2]byte{1, 2},
        [2]byte{3, 4}}

    bz, err := cdc.MarshalBinaryBare(arr)
    assert.NoError(t, err)
    t.Log(bz)
    var a [][]byte
    cdc.UnmarshalBinaryBare(bz,&a)
    t.Log(a)
}

the result is

=== RUN   TestMultidimensionalByteSlice
--- PASS: TestMultidimensionalByteSlice (0.00s)
    proto3_compat_test.go:136: [10]
    proto3_compat_test.go:139: []
PASS

BTW, I submitted a report to the hackerone bug bounty program, but the response is not very timely, So I create an issue here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions