Skip to content

Commit 5cb3453

Browse files
Backport #94855 to 25.8: Add index out of range check in advanced shared data in JSON
1 parent 220df44 commit 5cb3453

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
@@ -226,6 +226,9 @@ void deserializeIndexesAndCollectPathsImpl(ColumnString & paths_column, ReadBuff
226226
T index;
227227
readBinaryLittleEndian(index, istr);
228228

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

288290
}

0 commit comments

Comments
 (0)