Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to restrict slice size in io.ReadVarBytes() #1087

Merged
merged 2 commits into from
Jun 22, 2020

Conversation

fyrchik
Copy link
Contributor

@fyrchik fyrchik commented Jun 22, 2020

Jun 12 06:29:45 nodoka neo-go[2976]: panic: runtime error: makeslice: len out of range
Jun 12 06:29:45 nodoka neo-go[2976]: goroutine 645 [running]:
Jun 12 06:29:45 nodoka neo-go[2976]: github.com/nspcc-dev/neo-go/pkg/io.(*BinReader).ReadVarBytes(0xc033febd00, 0xc03174d380, 0xc033942184, 0x40)
Jun 12 06:29:45 nodoka neo-go[2976]: #011/home/rik/dev/neo-go2/pkg/io/binaryReader.go:173 +0x4e
Jun 12 06:29:45 nodoka neo-go[2976]: github.com/nspcc-dev/neo-go/pkg/consensus.(*commitCompact).DecodeBinary(0xc033942180, 0xc033febd00)
Jun 12 06:29:45 nodoka neo-go[2976]: #011/home/rik/dev/neo-go2/pkg/consensus/recovery_message.go:115 +0x6d
Jun 12 06:29:45 nodoka neo-go[2976]: github.com/nspcc-dev/neo-go/pkg/io.(*BinReader).ReadArray(0xc033febd00, 0xc3eb40, 0xc033942020, 0x0, 0x0, 0x0)
Jun 12 06:29:45 nodoka neo-go[2976]: #011/home/rik/dev/neo-go2/pkg/io/binaryReader.go:141 +0x22f
Jun 12 06:29:45 nodoka neo-go[2976]: github.com/nspcc-dev/neo-go/pkg/consensus.(*recoveryMessage).DecodeBinary(0xc033942000, 0xc033febd00)
Jun 12 06:29:45 nodoka neo-go[2976]: #011/home/rik/dev/neo-go2/pkg/consensus/recovery_message.go:70 +0x12d
Jun 12 06:29:45 nodoka neo-go[2976]: github.com/nspcc-dev/neo-go/pkg/consensus.(*message).DecodeBinary(0xc00f3a76a0, 0xc033febd00)
Jun 12 06:29:45 nodoka neo-go[2976]: #011/home/rik/dev/neo-go2/pkg/consensus/payload.go:299 +0x157
Jun 12 06:29:45 nodoka neo-go[2976]: github.com/nspcc-dev/neo-go/pkg/consensus.(*Payload).decodeData(0xc033feb880, 0x102aea0, 0xc033feb880)
Jun 12 06:29:45 nodoka neo-go[2976]: #011/home/rik/dev/neo-go2/pkg/consensus/payload.go:326 +0x1b1
Jun 12 06:29:45 nodoka neo-go[2976]: github.com/nspcc-dev/neo-go/pkg/consensus.(*service).OnPayload(0xc0000ecb40, 0xc033feb880)
Jun 12 06:29:45 nodoka neo-go[2976]: #011/home/rik/dev/neo-go2/pkg/consensus/consensus.go:296 +0x3ea
Jun 12 06:29:45 nodoka neo-go[2976]: github.com/nspcc-dev/neo-go/pkg/network.(*Server).handleConsensusCmd(...)
Jun 12 06:29:45 nodoka neo-go[2976]: #011/home/rik/dev/neo-go2/pkg/network/server.go:644
Jun 12 06:29:45 nodoka neo-go[2976]: github.com/nspcc-dev/neo-go/pkg/network.(*Server).handleMessage(0xc0000ba160, 0x104e300, 0xc0000ecd80, 0xc03174c600, 0x0, 0x0)
Jun 12 06:29:45 nodoka neo-go[2976]: #011/home/rik/dev/neo-go2/pkg/network/server.go:763 +0xd3e
Jun 12 06:29:45 nodoka neo-go[2976]: github.com/nspcc-dev/neo-go/pkg/network.(*TCPPeer).handleConn(0xc0000ecd80)
Jun 12 06:29:45 nodoka neo-go[2976]: #011/home/rik/dev/neo-go2/pkg/network/tcp_peer.go:160 +0x294
Jun 12 06:29:45 nodoka neo-go[2976]: created by github.com/nspcc-dev/neo-go/pkg/network.(*TCPTransport).Dial
Jun 12 06:29:45 nodoka neo-go[2976]: #011/home/rik/dev/neo-go2/pkg/network/tcp_transport.go:38 +0x1ad

@codecov
Copy link

codecov bot commented Jun 22, 2020

Codecov Report

Merging #1087 into neox-2.x will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##           neox-2.x    #1087   +/-   ##
=========================================
  Coverage     68.09%   68.10%           
=========================================
  Files           158      158           
  Lines         15363    15369    +6     
=========================================
+ Hits          10462    10467    +5     
- Misses         4394     4395    +1     
  Partials        507      507           
Impacted Files Coverage Δ
pkg/consensus/recovery_message.go 84.70% <100.00%> (ø)
pkg/io/binaryReader.go 100.00% <100.00%> (ø)
pkg/core/mpt/trie.go 92.43% <0.00%> (-0.43%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9767817...ad0cf14. Read the comment docs.

ms = maxSize[0]
}
if n > uint64(ms) {
r.Err = fmt.Errorf("array is too big (%d)", n)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

too big byte string (%d)?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To differentiate it from ReadArray error message at least.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@roman-khimov roman-khimov added this to the v0.76.0 milestone Jun 22, 2020
@roman-khimov roman-khimov merged commit fec8916 into neox-2.x Jun 22, 2020
@roman-khimov roman-khimov deleted the fix/readvarbytes branch June 22, 2020 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants