Flawfinder version 2.0.10, (C) 2001-2019 David A. Wheeler.
Number of rules (primarily dangerous function names) in C/C++ ruleset: 223
Examining data/faiss-1.6.5/benchs/bench_6bit_codec.cpp
Examining data/faiss-1.6.5/c_api/AutoTune_c.cpp
Examining data/faiss-1.6.5/c_api/AutoTune_c.h
Examining data/faiss-1.6.5/c_api/Clustering_c.cpp
Examining data/faiss-1.6.5/c_api/Clustering_c.h
Examining data/faiss-1.6.5/c_api/IndexFlat_c.cpp
Examining data/faiss-1.6.5/c_api/IndexFlat_c.h
Examining data/faiss-1.6.5/c_api/IndexIVFFlat_c.cpp
Examining data/faiss-1.6.5/c_api/IndexIVFFlat_c.h
Examining data/faiss-1.6.5/c_api/IndexIVF_c.cpp
Examining data/faiss-1.6.5/c_api/IndexIVF_c.h
Examining data/faiss-1.6.5/c_api/IndexLSH_c.cpp
Examining data/faiss-1.6.5/c_api/IndexLSH_c.h
Examining data/faiss-1.6.5/c_api/IndexPreTransform_c.cpp
Examining data/faiss-1.6.5/c_api/IndexPreTransform_c.h
Examining data/faiss-1.6.5/c_api/IndexShards_c.cpp
Examining data/faiss-1.6.5/c_api/IndexShards_c.h
Examining data/faiss-1.6.5/c_api/Index_c.cpp
Examining data/faiss-1.6.5/c_api/Index_c.h
Examining data/faiss-1.6.5/c_api/MetaIndexes_c.cpp
Examining data/faiss-1.6.5/c_api/MetaIndexes_c.h
Examining data/faiss-1.6.5/c_api/clone_index_c.cpp
Examining data/faiss-1.6.5/c_api/clone_index_c.h
Examining data/faiss-1.6.5/c_api/error_c.h
Examining data/faiss-1.6.5/c_api/error_impl.cpp
Examining data/faiss-1.6.5/c_api/error_impl.h
Examining data/faiss-1.6.5/c_api/example_c.c
Examining data/faiss-1.6.5/c_api/faiss_c.h
Examining data/faiss-1.6.5/c_api/gpu/GpuAutoTune_c.cpp
Examining data/faiss-1.6.5/c_api/gpu/GpuAutoTune_c.h
Examining data/faiss-1.6.5/c_api/gpu/GpuClonerOptions_c.cpp
Examining data/faiss-1.6.5/c_api/gpu/GpuClonerOptions_c.h
Examining data/faiss-1.6.5/c_api/gpu/GpuIndex_c.cpp
Examining data/faiss-1.6.5/c_api/gpu/GpuIndex_c.h
Examining data/faiss-1.6.5/c_api/gpu/GpuIndicesOptions_c.h
Examining data/faiss-1.6.5/c_api/gpu/GpuResources_c.cpp
Examining data/faiss-1.6.5/c_api/gpu/GpuResources_c.h
Examining data/faiss-1.6.5/c_api/gpu/StandardGpuResources_c.cpp
Examining data/faiss-1.6.5/c_api/gpu/StandardGpuResources_c.h
Examining data/faiss-1.6.5/c_api/gpu/example_gpu_c.c
Examining data/faiss-1.6.5/c_api/gpu/macros_impl.h
Examining data/faiss-1.6.5/c_api/impl/AuxIndexStructures_c.cpp
Examining data/faiss-1.6.5/c_api/impl/AuxIndexStructures_c.h
Examining data/faiss-1.6.5/c_api/index_factory_c.cpp
Examining data/faiss-1.6.5/c_api/index_factory_c.h
Examining data/faiss-1.6.5/c_api/index_io_c.cpp
Examining data/faiss-1.6.5/c_api/index_io_c.h
Examining data/faiss-1.6.5/c_api/macros_impl.h
Examining data/faiss-1.6.5/demos/demo_imi_flat.cpp
Examining data/faiss-1.6.5/demos/demo_imi_pq.cpp
Examining data/faiss-1.6.5/demos/demo_ivfpq_indexing.cpp
Examining data/faiss-1.6.5/demos/demo_sift1M.cpp
Examining data/faiss-1.6.5/demos/demo_weighted_kmeans.cpp
Examining data/faiss-1.6.5/faiss/AutoTune.cpp
Examining data/faiss-1.6.5/faiss/AutoTune.h
Examining data/faiss-1.6.5/faiss/Clustering.cpp
Examining data/faiss-1.6.5/faiss/Clustering.h
Examining data/faiss-1.6.5/faiss/DirectMap.cpp
Examining data/faiss-1.6.5/faiss/DirectMap.h
Examining data/faiss-1.6.5/faiss/IVFlib.cpp
Examining data/faiss-1.6.5/faiss/IVFlib.h
Examining data/faiss-1.6.5/faiss/Index.cpp
Examining data/faiss-1.6.5/faiss/Index.h
Examining data/faiss-1.6.5/faiss/Index2Layer.cpp
Examining data/faiss-1.6.5/faiss/Index2Layer.h
Examining data/faiss-1.6.5/faiss/IndexBinary.cpp
Examining data/faiss-1.6.5/faiss/IndexBinary.h
Examining data/faiss-1.6.5/faiss/IndexBinaryFlat.cpp
Examining data/faiss-1.6.5/faiss/IndexBinaryFlat.h
Examining data/faiss-1.6.5/faiss/IndexBinaryFromFloat.cpp
Examining data/faiss-1.6.5/faiss/IndexBinaryFromFloat.h
Examining data/faiss-1.6.5/faiss/IndexBinaryHNSW.cpp
Examining data/faiss-1.6.5/faiss/IndexBinaryHNSW.h
Examining data/faiss-1.6.5/faiss/IndexBinaryHash.cpp
Examining data/faiss-1.6.5/faiss/IndexBinaryHash.h
Examining data/faiss-1.6.5/faiss/IndexBinaryIVF.cpp
Examining data/faiss-1.6.5/faiss/IndexBinaryIVF.h
Examining data/faiss-1.6.5/faiss/IndexFlat.cpp
Examining data/faiss-1.6.5/faiss/IndexFlat.h
Examining data/faiss-1.6.5/faiss/IndexHNSW.cpp
Examining data/faiss-1.6.5/faiss/IndexHNSW.h
Examining data/faiss-1.6.5/faiss/IndexIVF.cpp
Examining data/faiss-1.6.5/faiss/IndexIVF.h
Examining data/faiss-1.6.5/faiss/IndexIVFFlat.cpp
Examining data/faiss-1.6.5/faiss/IndexIVFFlat.h
Examining data/faiss-1.6.5/faiss/IndexIVFPQ.cpp
Examining data/faiss-1.6.5/faiss/IndexIVFPQ.h
Examining data/faiss-1.6.5/faiss/IndexIVFPQR.cpp
Examining data/faiss-1.6.5/faiss/IndexIVFPQR.h
Examining data/faiss-1.6.5/faiss/IndexIVFSpectralHash.cpp
Examining data/faiss-1.6.5/faiss/IndexIVFSpectralHash.h
Examining data/faiss-1.6.5/faiss/IndexLSH.cpp
Examining data/faiss-1.6.5/faiss/IndexLSH.h
Examining data/faiss-1.6.5/faiss/IndexLattice.cpp
Examining data/faiss-1.6.5/faiss/IndexLattice.h
Examining data/faiss-1.6.5/faiss/IndexPQ.cpp
Examining data/faiss-1.6.5/faiss/IndexPQ.h
Examining data/faiss-1.6.5/faiss/IndexPreTransform.cpp
Examining data/faiss-1.6.5/faiss/IndexPreTransform.h
Examining data/faiss-1.6.5/faiss/IndexReplicas.cpp
Examining data/faiss-1.6.5/faiss/IndexReplicas.h
Examining data/faiss-1.6.5/faiss/IndexScalarQuantizer.cpp
Examining data/faiss-1.6.5/faiss/IndexScalarQuantizer.h
Examining data/faiss-1.6.5/faiss/IndexShards.cpp
Examining data/faiss-1.6.5/faiss/IndexShards.h
Examining data/faiss-1.6.5/faiss/InvertedLists.cpp
Examining data/faiss-1.6.5/faiss/InvertedLists.h
Examining data/faiss-1.6.5/faiss/MatrixStats.cpp
Examining data/faiss-1.6.5/faiss/MatrixStats.h
Examining data/faiss-1.6.5/faiss/MetaIndexes.cpp
Examining data/faiss-1.6.5/faiss/MetaIndexes.h
Examining data/faiss-1.6.5/faiss/MetricType.h
Examining data/faiss-1.6.5/faiss/OnDiskInvertedLists.cpp
Examining data/faiss-1.6.5/faiss/OnDiskInvertedLists.h
Examining data/faiss-1.6.5/faiss/VectorTransform.cpp
Examining data/faiss-1.6.5/faiss/VectorTransform.h
Examining data/faiss-1.6.5/faiss/clone_index.cpp
Examining data/faiss-1.6.5/faiss/clone_index.h
Examining data/faiss-1.6.5/faiss/gpu/GpuAutoTune.cpp
Examining data/faiss-1.6.5/faiss/gpu/GpuAutoTune.h
Examining data/faiss-1.6.5/faiss/gpu/GpuCloner.cpp
Examining data/faiss-1.6.5/faiss/gpu/GpuCloner.h
Examining data/faiss-1.6.5/faiss/gpu/GpuClonerOptions.cpp
Examining data/faiss-1.6.5/faiss/gpu/GpuClonerOptions.h
Examining data/faiss-1.6.5/faiss/gpu/GpuDistance.h
Examining data/faiss-1.6.5/faiss/gpu/GpuFaissAssert.h
Examining data/faiss-1.6.5/faiss/gpu/GpuIndex.h
Examining data/faiss-1.6.5/faiss/gpu/GpuIndexBinaryFlat.h
Examining data/faiss-1.6.5/faiss/gpu/GpuIndexFlat.h
Examining data/faiss-1.6.5/faiss/gpu/GpuIndexIVF.h
Examining data/faiss-1.6.5/faiss/gpu/GpuIndexIVFFlat.h
Examining data/faiss-1.6.5/faiss/gpu/GpuIndexIVFPQ.h
Examining data/faiss-1.6.5/faiss/gpu/GpuIndexIVFScalarQuantizer.h
Examining data/faiss-1.6.5/faiss/gpu/GpuIndicesOptions.h
Examining data/faiss-1.6.5/faiss/gpu/GpuResources.cpp
Examining data/faiss-1.6.5/faiss/gpu/GpuResources.h
Examining data/faiss-1.6.5/faiss/gpu/StandardGpuResources.cpp
Examining data/faiss-1.6.5/faiss/gpu/StandardGpuResources.h
Examining data/faiss-1.6.5/faiss/gpu/impl/RemapIndices.cpp
Examining data/faiss-1.6.5/faiss/gpu/impl/RemapIndices.h
Examining data/faiss-1.6.5/faiss/gpu/perf/IndexWrapper-inl.h
Examining data/faiss-1.6.5/faiss/gpu/perf/IndexWrapper.h
Examining data/faiss-1.6.5/faiss/gpu/perf/PerfClustering.cpp
Examining data/faiss-1.6.5/faiss/gpu/perf/PerfIVFPQAdd.cpp
Examining data/faiss-1.6.5/faiss/gpu/perf/WriteIndex.cpp
Examining data/faiss-1.6.5/faiss/gpu/test/TestGpuIndexBinaryFlat.cpp
Examining data/faiss-1.6.5/faiss/gpu/test/TestGpuIndexFlat.cpp
Examining data/faiss-1.6.5/faiss/gpu/test/TestGpuIndexIVFFlat.cpp
Examining data/faiss-1.6.5/faiss/gpu/test/TestGpuIndexIVFPQ.cpp
Examining data/faiss-1.6.5/faiss/gpu/test/TestGpuIndexIVFScalarQuantizer.cpp
Examining data/faiss-1.6.5/faiss/gpu/test/TestGpuMemoryException.cpp
Examining data/faiss-1.6.5/faiss/gpu/test/TestUtils.cpp
Examining data/faiss-1.6.5/faiss/gpu/test/TestUtils.h
Examining data/faiss-1.6.5/faiss/gpu/test/demo_ivfpq_indexing_gpu.cpp
Examining data/faiss-1.6.5/faiss/gpu/utils/DeviceUtils.h
Examining data/faiss-1.6.5/faiss/gpu/utils/StackDeviceMemory.cpp
Examining data/faiss-1.6.5/faiss/gpu/utils/StackDeviceMemory.h
Examining data/faiss-1.6.5/faiss/gpu/utils/StaticUtils.h
Examining data/faiss-1.6.5/faiss/gpu/utils/Timer.cpp
Examining data/faiss-1.6.5/faiss/gpu/utils/Timer.h
Examining data/faiss-1.6.5/faiss/impl/AuxIndexStructures.cpp
Examining data/faiss-1.6.5/faiss/impl/AuxIndexStructures.h
Examining data/faiss-1.6.5/faiss/impl/FaissAssert.h
Examining data/faiss-1.6.5/faiss/impl/FaissException.cpp
Examining data/faiss-1.6.5/faiss/impl/FaissException.h
Examining data/faiss-1.6.5/faiss/impl/HNSW.cpp
Examining data/faiss-1.6.5/faiss/impl/HNSW.h
Examining data/faiss-1.6.5/faiss/impl/PolysemousTraining.cpp
Examining data/faiss-1.6.5/faiss/impl/PolysemousTraining.h
Examining data/faiss-1.6.5/faiss/impl/ProductQuantizer-inl.h
Examining data/faiss-1.6.5/faiss/impl/ProductQuantizer.cpp
Examining data/faiss-1.6.5/faiss/impl/ProductQuantizer.h
Examining data/faiss-1.6.5/faiss/impl/ResultHandler.h
Examining data/faiss-1.6.5/faiss/impl/ScalarQuantizer.cpp
Examining data/faiss-1.6.5/faiss/impl/ScalarQuantizer.h
Examining data/faiss-1.6.5/faiss/impl/ThreadedIndex-inl.h
Examining data/faiss-1.6.5/faiss/impl/ThreadedIndex.h
Examining data/faiss-1.6.5/faiss/impl/index_read.cpp
Examining data/faiss-1.6.5/faiss/impl/index_write.cpp
Examining data/faiss-1.6.5/faiss/impl/io.cpp
Examining data/faiss-1.6.5/faiss/impl/io.h
Examining data/faiss-1.6.5/faiss/impl/io_macros.h
Examining data/faiss-1.6.5/faiss/impl/lattice_Zn.cpp
Examining data/faiss-1.6.5/faiss/impl/lattice_Zn.h
Examining data/faiss-1.6.5/faiss/impl/platform_macros.h
Examining data/faiss-1.6.5/faiss/index_factory.cpp
Examining data/faiss-1.6.5/faiss/index_factory.h
Examining data/faiss-1.6.5/faiss/index_io.h
Examining data/faiss-1.6.5/faiss/python/python_callbacks.cpp
Examining data/faiss-1.6.5/faiss/python/python_callbacks.h
Examining data/faiss-1.6.5/faiss/utils/Heap.cpp
Examining data/faiss-1.6.5/faiss/utils/Heap.h
Examining data/faiss-1.6.5/faiss/utils/WorkerThread.cpp
Examining data/faiss-1.6.5/faiss/utils/WorkerThread.h
Examining data/faiss-1.6.5/faiss/utils/distances.cpp
Examining data/faiss-1.6.5/faiss/utils/distances.h
Examining data/faiss-1.6.5/faiss/utils/distances_simd.cpp
Examining data/faiss-1.6.5/faiss/utils/extra_distances.cpp
Examining data/faiss-1.6.5/faiss/utils/extra_distances.h
Examining data/faiss-1.6.5/faiss/utils/hamming-inl.h
Examining data/faiss-1.6.5/faiss/utils/hamming.cpp
Examining data/faiss-1.6.5/faiss/utils/hamming.h
Examining data/faiss-1.6.5/faiss/utils/ordered_key_value.h
Examining data/faiss-1.6.5/faiss/utils/partitioning.cpp
Examining data/faiss-1.6.5/faiss/utils/partitioning.h
Examining data/faiss-1.6.5/faiss/utils/random.cpp
Examining data/faiss-1.6.5/faiss/utils/random.h
Examining data/faiss-1.6.5/faiss/utils/simdlib.h
Examining data/faiss-1.6.5/faiss/utils/utils.cpp
Examining data/faiss-1.6.5/faiss/utils/utils.h
Examining data/faiss-1.6.5/misc/test_blas.cpp
Examining data/faiss-1.6.5/tests/test_binary_flat.cpp
Examining data/faiss-1.6.5/tests/test_dealloc_invlists.cpp
Examining data/faiss-1.6.5/tests/test_ivfpq_codec.cpp
Examining data/faiss-1.6.5/tests/test_ivfpq_indexing.cpp
Examining data/faiss-1.6.5/tests/test_lowlevel_ivf.cpp
Examining data/faiss-1.6.5/tests/test_merge.cpp
Examining data/faiss-1.6.5/tests/test_omp_threads.cpp
Examining data/faiss-1.6.5/tests/test_ondisk_ivf.cpp
Examining data/faiss-1.6.5/tests/test_pairs_decoding.cpp
Examining data/faiss-1.6.5/tests/test_params_override.cpp
Examining data/faiss-1.6.5/tests/test_pq_encoding.cpp
Examining data/faiss-1.6.5/tests/test_sliding_ivf.cpp
Examining data/faiss-1.6.5/tests/test_threaded_index.cpp
Examining data/faiss-1.6.5/tests/test_transfer_invlists.cpp
Examining data/faiss-1.6.5/tutorial/cpp/1-Flat.cpp
Examining data/faiss-1.6.5/tutorial/cpp/2-IVFFlat.cpp
Examining data/faiss-1.6.5/tutorial/cpp/3-IVFPQ.cpp
Examining data/faiss-1.6.5/tutorial/cpp/4-GPU.cpp
Examining data/faiss-1.6.5/tutorial/cpp/5-Multiple-GPUs.cpp

FINAL RESULTS:

data/faiss-1.6.5/faiss/MatrixStats.cpp:68:19:  [4] (format) vsnprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
    size_t size = vsnprintf(buf, nbuf, fmt, ap);
data/faiss-1.6.5/faiss/impl/FaissAssert.h:65:18:  [4] (format) snprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
    int __size = snprintf(nullptr, 0, FMT, __VA_ARGS__);                \
data/faiss-1.6.5/faiss/impl/FaissAssert.h:67:5:  [4] (format) snprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
    snprintf(&__s[0], __s.size(), FMT, __VA_ARGS__);                    \
data/faiss-1.6.5/faiss/impl/PolysemousTraining.cpp:802:13:  [4] (format) snprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
            snprintf (fname, 256, log_pattern.c_str(), m);
data/faiss-1.6.5/faiss/impl/PolysemousTraining.cpp:905:13:  [4] (format) snprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
            snprintf (fname, 256, log_pattern.c_str(), m);
data/faiss-1.6.5/faiss/index_factory.cpp:146:20:  [4] (buffer) sscanf:
  The scanf() family's %s operation, without a limit specification, permits
  buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a
  different input function. If the scanf format is influenceable by an
  attacker, it's exploitable.
                   sscanf (tok, "IVF%" PRId64, &ncentroids) == 1) {
data/faiss-1.6.5/faiss/index_factory.cpp:167:20:  [4] (buffer) sscanf:
  The scanf() family's %s operation, without a limit specification, permits
  buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a
  different input function. If the scanf format is influenceable by an
  attacker, it's exploitable.
                   sscanf (tok, "Residual%" PRId64, &ncentroids) == 1) {
data/faiss-1.6.5/faiss/utils/simdlib.h:88:20:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
            ptr += sprintf(ptr, fmt, bytes[i]);
data/faiss-1.6.5/faiss/utils/simdlib.h:259:20:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
            ptr += sprintf(ptr, fmt, bytes[i]);
data/faiss-1.6.5/faiss/utils/simdlib.h:332:20:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
            ptr += sprintf(ptr, fmt, bytes[i]);
data/faiss-1.6.5/tests/test_merge.cpp:41:13:  [4] (race) access:
  This usually indicates a security flaw. If an attacker can change anything
  along the path between the call to access() and the file's actual use
  (e.g., by moving files), the attacker can exploit the race condition
  (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid())
  and try to open the file directly.
        if (access (filename.c_str(), F_OK)) {
data/faiss-1.6.5/tests/test_ondisk_ivf.cpp:43:13:  [4] (race) access:
  This usually indicates a security flaw. If an attacker can change anything
  along the path between the call to access() and the file's actual use
  (e.g., by moving files), the attacker can exploit the race condition
  (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid())
  and try to open the file directly.
        if (access (filename.c_str(), F_OK)) {
data/faiss-1.6.5/c_api/example_c.c:37:5:  [3] (random) srand:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
    srand(seed);
data/faiss-1.6.5/c_api/gpu/example_gpu_c.c:36:5:  [3] (random) srand:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
    srand(seed);
data/faiss-1.6.5/tests/test_merge.cpp:34:24:  [3] (tmpfile) tempnam:
  Temporary file race condition (CWE-377).
        char *cfname = tempnam (nullptr, prefix);
data/faiss-1.6.5/tests/test_ondisk_ivf.cpp:36:24:  [3] (tmpfile) tempnam:
  Temporary file race condition (CWE-377).
        char *cfname = tempnam (nullptr, prefix);
data/faiss-1.6.5/c_api/IndexIVF_c.cpp:94:5:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
    memcpy(invlist, list, list_size*sizeof(idx_t));
data/faiss-1.6.5/demos/demo_sift1M.cpp:41:15:  [2] (misc) fopen:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
    FILE *f = fopen(fname, "r");
data/faiss-1.6.5/demos/demo_weighted_kmeans.cpp:61:5:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
    memcpy(centroids, clus.centroids.data(), sizeof(*centroids) * d * k);
data/faiss-1.6.5/demos/demo_weighted_kmeans.cpp:130:25:  [2] (integer) atoi:
  Unless checked, the resulting number can exceed the expected range
  (CWE-190). If source untrusted, check both minimum and maximum, even if the
  input had no minus sign (large numbers can roll over into negative number;
  consider saving to an unsigned value if that is intended).
        the_index_num = atoi(argv[1]);
data/faiss-1.6.5/demos/demo_weighted_kmeans.cpp:131:28:  [2] (integer) atoi:
  Unless checked, the resulting number can exceed the expected range
  (CWE-190). If source untrusted, check both minimum and maximum, even if the
  input had no minus sign (large numbers can roll over into negative number;
  consider saving to an unsigned value if that is intended).
        the_with_weights = atoi(argv[2]);
data/faiss-1.6.5/faiss/AutoTune.cpp:54:9:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
        memcpy (gt_D.data(), gt_D_in, sizeof (gt_D[0]) * nq * gt_nnn);
data/faiss-1.6.5/faiss/AutoTune.cpp:57:5:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
    memcpy (gt_I.data(), gt_I_in, sizeof (gt_I[0]) * nq * gt_nnn);
data/faiss-1.6.5/faiss/AutoTune.cpp:202:15:  [2] (misc) fopen:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
    FILE *f = fopen(fname, "w");
data/faiss-1.6.5/faiss/AutoTune.cpp:217:15:  [2] (misc) fopen:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
    FILE *f = fopen(fname, "w");
data/faiss-1.6.5/faiss/AutoTune.cpp:292:5:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
    char buf[1000], *wp = buf;
data/faiss-1.6.5/faiss/AutoTune.cpp:447:9:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
        char name[100];
data/faiss-1.6.5/faiss/Clustering.cpp:110:9:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
        memcpy (x_new + i * line_size, x + perm[i] * line_size, line_size);
data/faiss-1.6.5/faiss/Clustering.cpp:239:13:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
            memcpy (centroids+ci*d, centroids+cj*d, sizeof(*centroids) * d);
data/faiss-1.6.5/faiss/Clustering.cpp:325:13:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
            memcpy (centroids.data(), x_in, sizeof (float) * d * k);
data/faiss-1.6.5/faiss/Clustering.cpp:398:17:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
                memcpy (&centroids[i * d], x + perm[i] * line_size, line_size);
data/faiss-1.6.5/faiss/Clustering.cpp:527:5:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
    memcpy(centroids, clus.centroids.data(), sizeof(*centroids) * d * k);
data/faiss-1.6.5/faiss/IVFlib.cpp:200:5:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
    memcpy (dst.data() + insert_point, src.data (), src.size() * sizeof(T));
data/faiss-1.6.5/faiss/Index2Layer.cpp:154:9:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
        memcpy (wp, &codes1[i], code_size_1);
data/faiss-1.6.5/faiss/Index2Layer.cpp:156:9:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
        memcpy (wp, &codes2[i * code_size_2], code_size_2);
data/faiss-1.6.5/faiss/Index2Layer.cpp:182:9:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
        memcpy (&key, rp, code_size_1);
data/faiss-1.6.5/faiss/Index2Layer.cpp:204:9:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
        memcpy (&key, rp, code_size_1);
data/faiss-1.6.5/faiss/Index2Layer.cpp:277:9:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
        memcpy (&key, code, storage.code_size_1);
data/faiss-1.6.5/faiss/Index2Layer.cpp:325:9:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
        memcpy (&key01, code, storage.code_size_1);
data/faiss-1.6.5/faiss/IndexBinaryFlat.cpp:79:3:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
  memcpy(recons, &(xb[code_size * key]), sizeof(*recons) * code_size);
data/faiss-1.6.5/faiss/IndexBinaryIVF.cpp:199:3:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
  memcpy(recons, invlists->get_single_code(list_no, offset), code_size);
data/faiss-1.6.5/faiss/IndexFlat.cpp:206:5:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
    memcpy (recons, &(xb[key * d]), sizeof(*recons) * d);
data/faiss-1.6.5/faiss/IndexFlat.cpp:218:5:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
    memcpy (bytes, x, sizeof(float) * d * n);
data/faiss-1.6.5/faiss/IndexFlat.cpp:223:5:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
    memcpy (x, bytes, sizeof(float) * d * n);
data/faiss-1.6.5/faiss/IndexIVFFlat.cpp:91:9:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
        memcpy (codes, x, code_size * n);
data/faiss-1.6.5/faiss/IndexIVFFlat.cpp:100:17:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
                memcpy (code + coarse_size, xi, code_size);
data/faiss-1.6.5/faiss/IndexIVFFlat.cpp:116:9:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
        memcpy (xi, code + coarse_size, code_size);
data/faiss-1.6.5/faiss/IndexIVFFlat.cpp:218:5:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
    memcpy (recons, invlists->get_single_code (list_no, offset), code_size);
data/faiss-1.6.5/faiss/IndexIVFFlat.cpp:246:13:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
            memcpy (x2 + n2 * d, x + i * d, code_size);
data/faiss-1.6.5/faiss/IndexIVFFlat.cpp:359:13:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
            memcpy (labels1 + j0, labels2.data() + j0,
data/faiss-1.6.5/faiss/IndexIVFFlat.cpp:361:13:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
            memcpy (dis1 + j0, dis2.data() + j0,
data/faiss-1.6.5/faiss/IndexIVFPQ.cpp:343:9:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
        char comment[100] = {0};
data/faiss-1.6.5/faiss/IndexIVFPQ.cpp:477:17:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
                memcpy (centroids.data() + i * d + m * cpq.dsub,
data/faiss-1.6.5/faiss/IndexLSH.cpp:72:13:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
            memcpy (xt, x, sizeof(*x) * n * nbits);
data/faiss-1.6.5/faiss/IndexLSH.cpp:217:13:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
            memcpy (x + i * d, xt + i * nbits,
data/faiss-1.6.5/faiss/IndexPQ.cpp:1027:9:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
        memcpy(recons, pq.get_centroids(m, n), sizeof(recons[0]) * pq.dsub);
data/faiss-1.6.5/faiss/IndexPQ.cpp:1121:13:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
            memcpy(xdest, xsrc, dsub * sizeof(xdest[0]));
data/faiss-1.6.5/faiss/InvertedLists.cpp:151:5:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
    memcpy (&ids[list_no][o], ids_in, sizeof (ids_in[0]) * n_entry);
data/faiss-1.6.5/faiss/InvertedLists.cpp:153:5:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
    memcpy (&codes[list_no][o * code_size], code, code_size * n_entry);
data/faiss-1.6.5/faiss/InvertedLists.cpp:188:5:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
    memcpy (&ids[list_no][offset], ids_in, sizeof(ids_in[0]) * n_entry);
data/faiss-1.6.5/faiss/InvertedLists.cpp:189:5:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
    memcpy (&codes[list_no][offset * code_size], codes_in, code_size * n_entry);
data/faiss-1.6.5/faiss/InvertedLists.cpp:256:13:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
            memcpy (c, ScopedCodes (il, list_no).get(), sz);
data/faiss-1.6.5/faiss/InvertedLists.cpp:272:13:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
            memcpy (code, ScopedCodes (il, list_no, offset).get(), code_size);
data/faiss-1.6.5/faiss/InvertedLists.cpp:293:13:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
            memcpy (c, ScopedIds (il, list_no).get(), sz * sizeof(idx_t));
data/faiss-1.6.5/faiss/MetaIndexes.cpp:287:13:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
            memcpy (sub_x + i * sub_d, x + ofs + i * d, sub_d * sizeof (sub_x));
data/faiss-1.6.5/faiss/OnDiskInvertedLists.cpp:280:15:  [2] (misc) fopen:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
    FILE *f = fopen (filename.c_str(), rw_flags);
data/faiss-1.6.5/faiss/OnDiskInvertedLists.cpp:307:19:  [2] (misc) fopen:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
        FILE *f = fopen (filename.c_str(), "w");
data/faiss-1.6.5/faiss/OnDiskInvertedLists.cpp:437:5:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
    memcpy (ids + offset, ids_in, sizeof(ids_in[0]) * n_entry);
data/faiss-1.6.5/faiss/OnDiskInvertedLists.cpp:439:5:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
    memcpy (codes + offset * code_size, codes_in, code_size * n_entry);
data/faiss-1.6.5/faiss/OnDiskInvertedLists.cpp:498:13:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
            memcpy (ptr + new_l.offset, get_codes(list_no), n * code_size);
data/faiss-1.6.5/faiss/OnDiskInvertedLists.cpp:499:13:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
            memcpy (ptr + new_l.offset + new_l.capacity * code_size,
data/faiss-1.6.5/faiss/OnDiskInvertedLists.cpp:674:5:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
    memcpy (new_lists.data(), &lists[l0], (l1 - l0) * sizeof(List));
data/faiss-1.6.5/faiss/VectorTransform.cpp:554:17:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
                memcpy (&A[row_dst * d_in], &Ain[i * d_in],
data/faiss-1.6.5/faiss/VectorTransform.cpp:629:9:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
        memcpy (rotation.data(), init_rotation.data(),
data/faiss-1.6.5/faiss/VectorTransform.cpp:1029:9:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
        memcpy (xt, x, sizeof (x[0]) * n * d_in);
data/faiss-1.6.5/faiss/VectorTransform.cpp:1039:5:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
    memcpy (x, xt, sizeof (xt[0]) * n * d_in);
data/faiss-1.6.5/faiss/gpu/test/TestUtils.h:110:10:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
    std::memcpy(cpuCodes.data(), sc.get(),
data/faiss-1.6.5/faiss/gpu/test/TestUtils.h:118:10:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
    std::memcpy(cpuIndices.data(), si.get(),
data/faiss-1.6.5/faiss/impl/AuxIndexStructures.cpp:108:9:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
        memcpy (dest_ids, buf.ids + ofs, ncopy * sizeof(*dest_ids));
data/faiss-1.6.5/faiss/impl/AuxIndexStructures.cpp:109:9:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
        memcpy (dest_dis, buf.dis + ofs, ncopy * sizeof(*dest_dis));
data/faiss-1.6.5/faiss/impl/PolysemousTraining.cpp:111:13:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
            memcpy (best_perm, perm.data(), sizeof(perm[0]) * n);
data/faiss-1.6.5/faiss/impl/PolysemousTraining.cpp:801:13:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
            char fname[256];
data/faiss-1.6.5/faiss/impl/PolysemousTraining.cpp:804:29:  [2] (misc) fopen:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
            optim.logfile = fopen (fname, "w");
data/faiss-1.6.5/faiss/impl/PolysemousTraining.cpp:821:13:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
            memcpy (centroids + perm[i] * dsub,
data/faiss-1.6.5/faiss/impl/PolysemousTraining.cpp:856:17:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
                memcpy (xtrain.data() + i * dsub,
data/faiss-1.6.5/faiss/impl/PolysemousTraining.cpp:882:13:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
            memcpy (gt_distances.data (),
data/faiss-1.6.5/faiss/impl/PolysemousTraining.cpp:904:13:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
            char fname[256];
data/faiss-1.6.5/faiss/impl/PolysemousTraining.cpp:907:29:  [2] (misc) fopen:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
            optim.logfile = fopen (fname, "w");
data/faiss-1.6.5/faiss/impl/PolysemousTraining.cpp:927:13:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
            memcpy (centroids + perm[i] * dsub,
data/faiss-1.6.5/faiss/impl/ProductQuantizer.cpp:200:3:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
  memcpy (get_centroids(m, 0), centroids_,
data/faiss-1.6.5/faiss/impl/ProductQuantizer.cpp:273:17:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
                memcpy (xslice + j * dsub,
data/faiss-1.6.5/faiss/impl/ProductQuantizer.cpp:294:17:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
                memcpy (clus.centroids.data(),
data/faiss-1.6.5/faiss/impl/ProductQuantizer.cpp:376:5:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
    memcpy(x + m * pq.dsub, pq.get_centroids(m, c), sizeof(float) * pq.dsub);
data/faiss-1.6.5/faiss/impl/ProductQuantizer.cpp:447:17:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
                memcpy (xslice + (i - i0) * dsub,
data/faiss-1.6.5/faiss/impl/ScalarQuantizer.cpp:627:9:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
        memcpy(x_copy.data(), x, n * sizeof(*x));
data/faiss-1.6.5/faiss/impl/ScalarQuantizer.cpp:704:9:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
        memcpy (vmin, x, sizeof(*x) * d);
data/faiss-1.6.5/faiss/impl/ScalarQuantizer.cpp:705:9:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
        memcpy (vmax, x, sizeof(*x) * d);
data/faiss-1.6.5/faiss/impl/index_read.cpp:450:17:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
                memcpy(ail->codes[i].data(), vec.data(),
data/faiss-1.6.5/faiss/impl/io.cpp:48:9:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
        memcpy (&data[o], ptr, size * nitems);
data/faiss-1.6.5/faiss/impl/io.cpp:60:9:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
        memcpy (ptr, &data[rp], size * nitems);
data/faiss-1.6.5/faiss/impl/io.cpp:80:9:  [2] (misc) fopen:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
    f = fopen(fname, "rb");
data/faiss-1.6.5/faiss/impl/io.cpp:110:9:  [2] (misc) fopen:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
    f = fopen(fname, "wb");
data/faiss-1.6.5/faiss/impl/io.cpp:154:9:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
        memcpy (dst, buffer.data() + b0, nb);
data/faiss-1.6.5/faiss/impl/io.cpp:175:9:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
        memcpy (dst, buffer.data(), nb2);
data/faiss-1.6.5/faiss/impl/io.cpp:200:9:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
        memcpy (buffer.data() + b0, src, nb);
data/faiss-1.6.5/faiss/impl/io.cpp:218:9:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
        memcpy (buffer.data(), src, nb1);
data/faiss-1.6.5/faiss/impl/io.cpp:244:25:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
uint32_t fourcc (const  char sx[4]) {
data/faiss-1.6.5/faiss/impl/io.h:146:24:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
uint32_t fourcc (const char sx[4]);
data/faiss-1.6.5/faiss/impl/lattice_Zn.cpp:584:13:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
            memcpy(&cache[i * dimsub], c.data() + dim - dimsub,
data/faiss-1.6.5/faiss/impl/lattice_Zn.cpp:690:13:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
            memcpy(c + i * subdim,
data/faiss-1.6.5/faiss/python/python_callbacks.cpp:101:9:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
        memcpy(ptr, PyBytes_AsString(result), sz);
data/faiss-1.6.5/faiss/utils/simdlib.h:53:14:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
    void bin(char bits[257]) const {
data/faiss-1.6.5/faiss/utils/simdlib.h:54:9:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
        char bytes[32];
data/faiss-1.6.5/faiss/utils/simdlib.h:63:9:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
        char bits[257];
data/faiss-1.6.5/faiss/utils/simdlib.h:86:9:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
        char res[1000], *ptr = res;
data/faiss-1.6.5/faiss/utils/simdlib.h:257:9:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
        char res[1000], *ptr = res;
data/faiss-1.6.5/faiss/utils/simdlib.h:330:9:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
        char res[1000], *ptr = res;
data/faiss-1.6.5/faiss/utils/simdlib.h:378:9:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
        char res[1000], *ptr = res;
data/faiss-1.6.5/faiss/utils/simdlib.h:380:20:  [2] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf. Risk is low because the source has a constant maximum length.
            ptr += sprintf(ptr, "%g,", tab[i]);
data/faiss-1.6.5/faiss/utils/utils.cpp:110:5:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
    char fname[256];
data/faiss-1.6.5/faiss/utils/utils.cpp:112:16:  [2] (misc) fopen:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
    FILE * f = fopen (fname, "r");
data/faiss-1.6.5/faiss/utils/utils.cpp:116:9:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
        char buf [256];
data/faiss-1.6.5/faiss/utils/utils.cpp:294:13:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
            memcpy (lD0, tmpD.data(), sizeof (lD0[0]) * k);
data/faiss-1.6.5/faiss/utils/utils.cpp:295:13:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
            memcpy (lI0, tmpI.data(), sizeof (lI0[0]) * k);
data/faiss-1.6.5/faiss/utils/utils.cpp:309:5:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
    memcpy (v2, v2_in, sizeof (int64_t) * k2);
data/faiss-1.6.5/faiss/utils/utils.cpp:491:17:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
                memcpy(dst + sw.i0, src + s1t.i0, s1t.len() * sizeof(dst[0]));
data/faiss-1.6.5/faiss/utils/utils.cpp:494:17:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
                memcpy(dst + sw.i0, src + s2t.i0, s2t.len() * sizeof(dst[0]));
data/faiss-1.6.5/faiss/utils/utils.cpp:554:17:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
                memcpy(permB + segs[s].i0, permA + segs[s].i0,
data/faiss-1.6.5/faiss/utils/utils.cpp:607:9:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
        memcpy (&x_subset[i * d],
data/faiss-1.6.5/tests/test_dealloc_invlists.cpp:92:16:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
        return memcpy (malloc(size), m, size);
data/faiss-1.6.5/c_api/AutoTune_c.cpp:46:9:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
        strncpy(char_buffer, rep.c_str(), size);
data/faiss-1.6.5/faiss/IndexLattice.cpp:112:21:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
                (rd.read (scale_nbit) + 0.5) *
data/faiss-1.6.5/faiss/IndexLattice.cpp:115:40:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
            zn_sphere_codec.decode (rd.read (lattice_nbit), xi);
data/faiss-1.6.5/faiss/OnDiskInvertedLists.cpp:727:44:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
InvertedLists * OnDiskInvertedListsIOHook::read(IOReader *f, int io_flags) const
data/faiss-1.6.5/faiss/OnDiskInvertedLists.h:139:21:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    InvertedLists * read(IOReader *f, int io_flags) const override;
data/faiss-1.6.5/faiss/impl/index_read.cpp:219:48:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        return InvertedListsIOHook::lookup(h)->read(f, io_flags);
data/faiss-1.6.5/faiss/impl/index_read.cpp:683:28:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        uint64_t hash = rd.read(b);
data/faiss-1.6.5/faiss/impl/index_read.cpp:684:28:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        uint64_t ilsz = rd.read(il_nbit);
data/faiss-1.6.5/faiss/impl/index_read.cpp:708:28:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        uint64_t hash = rd.read(b);
data/faiss-1.6.5/faiss/impl/index_read.cpp:709:28:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        uint64_t ilsz = rd.read(id_bits);
data/faiss-1.6.5/faiss/impl/index_read.cpp:712:30:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
            il.push_back (rd.read (id_bits));
data/faiss-1.6.5/faiss/impl/io.cpp:245:17:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
    assert(4 == strlen(sx));
data/faiss-1.6.5/faiss/index_io.h:100:29:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    virtual InvertedLists * read(IOReader *f, int io_flags) const = 0;
data/faiss-1.6.5/faiss/utils/hamming-inl.h:43:34:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
inline uint64_t BitstringReader::read(int nbit) {
data/faiss-1.6.5/faiss/utils/hamming.h:109:14:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    uint64_t read(int nbit);

ANALYSIS SUMMARY:

Hits = 145
Lines analyzed = 51377 in approximately 1.36 seconds (37807 lines/second)
Physical Source Lines of Code (SLOC) = 33897
Hits@level = [0] 434 [1]  15 [2] 114 [3]   4 [4]  12 [5]   0
Hits@level+ = [0+] 579 [1+] 145 [2+] 130 [3+]  16 [4+]  12 [5+]   0
Hits/KSLOC@level+ = [0+] 17.0812 [1+] 4.27766 [2+] 3.83515 [3+] 0.472018 [4+] 0.354014 [5+]   0
Dot directories skipped = 3 (--followdotdir overrides)
Minimum risk level = 1
Not every hit is necessarily a security vulnerability.
There may be other security vulnerabilities; review your code!
See 'Secure Programming HOWTO'
(https://dwheeler.com/secure-programs) for more information.