Skip to content

Commit 66d62fc

Browse files
Merge branch 'main' into fix-nullable-binary-arrays
2 parents f3e22cf + fe86ee2 commit 66d62fc

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
### Bug Fixes
66

77
- **[client-v2]** Fixed binary array decoding for nullable element types so `Array(Nullable(Float64))` and similar columns now return boxed arrays such as `Double[]` instead of `Object[]`. This keeps null-supporting arrays aligned with their element type while preserving the existing `Object[]` fallback for Variant/Dynamic/Geometry arrays. (https://github.com/ClickHouse/clickhouse-java/issues/2846)
8+
- **[client-v2]** Fixed binary varint decoding for length and count fields so overflowing or overlong values fail with an `IOException` instead of being decoded into corrupted or negative `int` values. (https://github.com/ClickHouse/clickhouse-java/issues/2902)
89

910
- **[client-v2]** Fixed container query parameters being sent unquoted, so `Client.query(sql, params, settings)` binding
1011
a `List<LocalDate>` (or an array/`Map`) to a placeholder like `{ids:Array(Date)}` was rejected by the server with

client-v2/src/main/java/com/clickhouse/client/api/data_formats/internal/BinaryStreamReader.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,16 +1022,20 @@ private double[][][][] readGeoMultiPolygon() throws IOException {
10221022
public static int readVarInt(InputStream input) throws IOException {
10231023
int value = 0;
10241024

1025-
for (int i = 0; i < 10; i++) {
1025+
for (int i = 0; i < 5; i++) {
10261026
byte b = (byte) readByteOrEOF(input);
1027+
if (i == 4 && (b & 0xF8) != 0) {
1028+
throw new IOException("VarInt is too large for int");
1029+
}
1030+
10271031
value |= (b & 0x7F) << (7 * i);
10281032

10291033
if ((b & 0x80) == 0) {
1030-
break;
1034+
return value;
10311035
}
10321036
}
10331037

1034-
return value;
1038+
throw new IOException("Malformed VarInt");
10351039
}
10361040

10371041
/**

0 commit comments

Comments
 (0)