You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
in the discriptorset add and add_n_store functions labels are copied to a memory location that goes out of scope.
Additional context
Labels are added for descriptor set to store class ids (integer values) or some strings.
The labels are later used in the function classify for majority vote on the labels
void DescriptorSet::classify(DescDataArray descriptors, unsigned n, long *labels, unsigned quorum)
The labels are set with the descriptorset insert functions when labels are not null
add(float *descriptors, unsigned n_descriptors, long *labels)"
add_and_store(float *descriptors, unsigned n_descriptors, long *labels)
these are mapped to the corresponding functions for each engine supported (FAISS, FLINNG, TileDB)
E.g. Faiss Engine (similar behavior with other engines) add function when the labels are not null, it copies labels to an unused memory location without setting the correct data structure and then returns
if (labels != NULL) {
_label_ids.resize(_index->ntotal + n);
long *dst = _label_ids.data() + _index->ntotal;
std::memcpy(dst, labels, n * sizeof(long));
}
The appropriate functions to correctly set the labels should be called.
example:
void DescriptorSet::set_labels_map(LabelIdVector &ids, std::vectorstd::string &labels) should be used to store the labels when the type of the labels is string and similar function (not implemented) for other types of labels.
The text was updated successfully, but these errors were encountered:
Describe the bug
in the discriptorset add and add_n_store functions labels are copied to a memory location that goes out of scope.
Additional context
Labels are added for descriptor set to store class ids (integer values) or some strings.
The labels are later used in the function classify for majority vote on the labels
void DescriptorSet::classify(DescDataArray descriptors, unsigned n, long *labels, unsigned quorum)
The labels are set with the descriptorset insert functions when labels are not null
these are mapped to the corresponding functions for each engine supported (FAISS, FLINNG, TileDB)
E.g. Faiss Engine (similar behavior with other engines) add function when the labels are not null, it copies labels to an unused memory location without setting the correct data structure and then returns
https://github.com/intel-inersource/libraries.databases.visual.vdms/blob/a96e8e21fef9ca369cb106eed5c7e4963e23ad11/src/vcl/FaissDescriptorSet.cc#L100
if (labels != NULL) {
_label_ids.resize(_index->ntotal + n);
long *dst = _label_ids.data() + _index->ntotal;
std::memcpy(dst, labels, n * sizeof(long));
}
The appropriate functions to correctly set the labels should be called.
example:
void DescriptorSet::set_labels_map(LabelIdVector &ids, std::vectorstd::string &labels) should be used to store the labels when the type of the labels is string and similar function (not implemented) for other types of labels.
The text was updated successfully, but these errors were encountered: