We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents aadb7ee + b64209f commit 0e83566Copy full SHA for 0e83566
.gitignore
@@ -13,3 +13,6 @@
13
14
# Dependency directories (remove the comment below to include it)
15
# vendor/
16
+
17
+# Editors
18
+.idea/
compress/writer.go
@@ -56,8 +56,12 @@ func (w *Writer) Compress(buf []byte) error {
56
n = copy(w.Data[headerSize:], buf)
57
}
58
59
- w.Data = w.Data[:n+headerSize]
+ // 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
+ }
63
64
+ w.Data = w.Data[:n+headerSize]
65
binary.LittleEndian.PutUint32(w.Data[hRawSize:], uint32(n+compressHeaderSize))
66
binary.LittleEndian.PutUint32(w.Data[hDataSize:], uint32(len(buf)))
67
h := city.CH128(w.Data[hMethod:])
0 commit comments