From 2e3b5b3f195ab3d4a8775f8bd162ea7dba7ff966 Mon Sep 17 00:00:00 2001 From: Kanthi Subramanian Date: Wed, 18 Nov 2026 09:53:01 -0800 Subject: [PATCH] Added upstream guard in IcebergFieldParseHelpers --- .../DataLakes/Iceberg/IcebergFieldParseHelpers.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Storages/ObjectStorage/DataLakes/Iceberg/IcebergFieldParseHelpers.cpp b/src/Storages/ObjectStorage/DataLakes/Iceberg/IcebergFieldParseHelpers.cpp index e062057a99c6a..bfd0c91d073cc 100644 --- a/src/Storages/ObjectStorage/DataLakes/Iceberg/IcebergFieldParseHelpers.cpp +++ b/src/Storages/ObjectStorage/DataLakes/Iceberg/IcebergFieldParseHelpers.cpp @@ -286,6 +286,12 @@ deserializeFieldFromBinaryRepr(const std::string & str, DataTypePtr expected_typ if (non_nullable_type->getTypeId() == TypeIndex::Variant) return std::nullopt; + /// `insertData` of a fixed-size column ignores the length and reads the width of the type, so a + /// shorter bound would read past the buffer. Iceberg keeps the bound as written, which for a + /// promoted column (`int` -> `long`) is narrower than the column is now. + if (non_nullable_type->haveMaximumSizeOfValue() && str.size() < non_nullable_type->getSizeOfValueInMemory()) + return std::nullopt; + /// For all other types except decimal binary representation /// matches our internal representation column->insertData(str.data(), str.length());