Skip to content

Commit d33cc3e

Browse files
committed
Remove memcpy
1 parent 897ee20 commit d33cc3e

File tree

1 file changed

+3
-1
lines changed
  • ydb/library/yql/udfs/common/knn

1 file changed

+3
-1
lines changed

ydb/library/yql/udfs/common/knn/knn.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,11 @@ NYql::NUdf::TUnboxedValue DeserializeDoubleVector(const IValueBuilder *valueBuil
4444
TUnboxedValue* items = nullptr;
4545
auto res = valueBuilder->NewArray(count, items);
4646

47+
TMemoryInput inStr(str);
4748
for (ui32 i = 0; i < count; ++i) {
4849
double element;
49-
memcpy(&element, str.Data() + i * sizeof(double), sizeof(double));
50+
if (inStr.Read(&element, sizeof(double)) != sizeof(double))
51+
return {};
5052
*items++ = TUnboxedValuePod{element};
5153
}
5254

0 commit comments

Comments
 (0)