Skip to content

Commit 9feffb0

Browse files
Backport #94855 to 25.12: Add index out of range check in advanced shared data in JSON
1 parent aa3b660 commit 9feffb0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/DataTypes/Serializations/SerializationObjectHelpers.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,9 @@ void deserializeIndexesAndCollectPathsImpl(ColumnString & paths_column, ReadBuff
227227
T index;
228228
readBinaryLittleEndian(index, istr);
229229

230+
if (index >= paths.size())
231+
throw Exception(ErrorCodes::LOGICAL_ERROR, "Object path index is out of range: {} >= {}", static_cast<UInt64>(index), paths.size());
232+
230233
const String & path = paths[index];
231234
offset += path.size();
232235
offsets.push_back(offset);
@@ -283,7 +286,6 @@ void deserializeIndexesAndCollectPaths(IColumn & paths_column, ReadBuffer & istr
283286
default:
284287
throw Exception(ErrorCodes::LOGICAL_ERROR, "Unexpected column type of paths indexes: {}", indexes_type->getName());
285288
}
286-
287289
}
288290

289291
}

0 commit comments

Comments
 (0)