Skip to content

Commit

Permalink
Error while expanding buffer in dechunker
Browse files Browse the repository at this point in the history
Serious issue that could cause corrupt data in records.
Fixes neo4j#183
  • Loading branch information
Peter Wilhelmsson committed Jan 26, 2021
1 parent e2f6706 commit 81176c5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion neo4j/internal/bolt/dechunker.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ func dechunkMessage(rd io.Reader, msgBuf []byte) ([]byte, error) {

// Need to expand buffer
if (off + chunkSize) > cap(msgBuf) {
msgBuf = append(msgBuf, make([]byte, off+chunkSize)...)
newMsgBuf := make([]byte, (off+chunkSize)+4096)
copy(newMsgBuf, msgBuf)
msgBuf = newMsgBuf
}
// Read the chunk into buffer
_, err = io.ReadFull(rd, msgBuf[off:(off+chunkSize)])
Expand Down

0 comments on commit 81176c5

Please sign in to comment.