Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- The `faiss::VectorIOWriter.data` is a vector of type `uint8_t`. However, the code attempts to copy this vector to a malloc'd array of type `unsigned char`. This results in platform-dependent code since `uint8_t` is platform-agnostic, whereas `unsigned char` is not defined consistently across different platforms in the C standard. - This issue becomes apparent when using `std::copy`, where the effective signature is `std::copy(uint8_t*, uint8_t*, unsigned char*)`. - According to the C++ STL template for `copy`, both the StartPointer and DestinationPointer are incremented by 1. The behavior of this pointer arithmetic depends on the type of pointer passed. Since `uint8_t*` is platform-agnostic and `unsigned char*` is platform-dependent, a buffer overflow could occur, leading to undefined behavior for `std::copy()` as per the C++ standard. - Also fixes a mismatched header file where the signature of `faiss_read_index_buf` was not matching the one defined in the source cpp file.
- Loading branch information