File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change 13
13
14
14
# Dependency directories (remove the comment below to include it)
15
15
# vendor/
16
+
17
+ # Editors
18
+ .idea /
Original file line number Diff line number Diff line change @@ -56,8 +56,12 @@ func (w *Writer) Compress(buf []byte) error {
56
56
n = copy (w .Data [headerSize :], buf )
57
57
}
58
58
59
- w .Data = w .Data [:n + headerSize ]
59
+ // security: https://github.com/ClickHouse/ch-go/pull/1041
60
+ if uint64 (n )+ uint64 (compressHeaderSize ) > math .MaxUint32 {
61
+ return errors .New ("compressed size overflows uint32" )
62
+ }
60
63
64
+ w .Data = w .Data [:n + headerSize ]
61
65
binary .LittleEndian .PutUint32 (w .Data [hRawSize :], uint32 (n + compressHeaderSize ))
62
66
binary .LittleEndian .PutUint32 (w .Data [hDataSize :], uint32 (len (buf )))
63
67
h := city .CH128 (w .Data [hMethod :])
You can’t perform that action at this time.
0 commit comments