values of type "[][]byte" are lost when marshalling
Opened this issue · 2 comments
rickyyangz commented
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.
zmanian commented
This bug doesn't appear to have any security implications so would be out of scope for the hackerone bug bounty.
I'm looking into if we can potentially do a bug release to fix this while we work on the full protobuf compatibility PRs
zmanian commented
This test case passes on the latest release v0.15
but does not pass in master
. master
is work in progress towards more complete protobuf compatibility.