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/megahit-1.2.9/src/assembly/all_algo.h Examining data/megahit-1.2.9/src/assembly/bubble_remover.cpp Examining data/megahit-1.2.9/src/assembly/bubble_remover.h Examining data/megahit-1.2.9/src/assembly/contig_output.cpp Examining data/megahit-1.2.9/src/assembly/contig_output.h Examining data/megahit-1.2.9/src/assembly/contig_stat.h Examining data/megahit-1.2.9/src/assembly/low_depth_remover.cpp Examining data/megahit-1.2.9/src/assembly/low_depth_remover.h Examining data/megahit-1.2.9/src/assembly/sdbg_pruning.cpp Examining data/megahit-1.2.9/src/assembly/sdbg_pruning.h Examining data/megahit-1.2.9/src/assembly/tip_remover.cpp Examining data/megahit-1.2.9/src/assembly/tip_remover.h Examining data/megahit-1.2.9/src/assembly/unitig_graph.cpp Examining data/megahit-1.2.9/src/assembly/unitig_graph.h Examining data/megahit-1.2.9/src/assembly/unitig_graph_vertex.h Examining data/megahit-1.2.9/src/assembly/weak_link_remover.cpp Examining data/megahit-1.2.9/src/assembly/weak_link_remover.h Examining data/megahit-1.2.9/src/definitions.h Examining data/megahit-1.2.9/src/idba/bit_edges.h Examining data/megahit-1.2.9/src/idba/bit_operation.h Examining data/megahit-1.2.9/src/idba/contig_builder.h Examining data/megahit-1.2.9/src/idba/contig_graph.cpp Examining data/megahit-1.2.9/src/idba/contig_graph.h Examining data/megahit-1.2.9/src/idba/contig_graph_branch_group.cpp Examining data/megahit-1.2.9/src/idba/contig_graph_branch_group.h Examining data/megahit-1.2.9/src/idba/contig_graph_path.h Examining data/megahit-1.2.9/src/idba/contig_graph_vertex.h Examining data/megahit-1.2.9/src/idba/contig_info.h Examining data/megahit-1.2.9/src/idba/functional.h Examining data/megahit-1.2.9/src/idba/hash.h Examining data/megahit-1.2.9/src/idba/hash_graph.cpp Examining data/megahit-1.2.9/src/idba/hash_graph.h Examining data/megahit-1.2.9/src/idba/hash_graph_path.h Examining data/megahit-1.2.9/src/idba/hash_graph_vertex.h Examining data/megahit-1.2.9/src/idba/hash_table.h Examining data/megahit-1.2.9/src/idba/kmer.h Examining data/megahit-1.2.9/src/idba/pool.h Examining data/megahit-1.2.9/src/idba/sequence.cpp Examining data/megahit-1.2.9/src/idba/sequence.h Examining data/megahit-1.2.9/src/idba/vertex_status.h Examining data/megahit-1.2.9/src/iterate/contig_flank_index.h Examining data/megahit-1.2.9/src/iterate/kmer_collector.h Examining data/megahit-1.2.9/src/kmlib/kmbit.h Examining data/megahit-1.2.9/src/kmlib/kmbitvector.h Examining data/megahit-1.2.9/src/kmlib/kmcompactvector.h Examining data/megahit-1.2.9/src/kmlib/kmrns.h Examining data/megahit-1.2.9/src/kmlib/kmsort.h Examining data/megahit-1.2.9/src/kmlib/test_compactvector.cpp Examining data/megahit-1.2.9/src/kmlib/test_kmbit.cpp Examining data/megahit-1.2.9/src/localasm/hash_mapper.cpp Examining data/megahit-1.2.9/src/localasm/hash_mapper.h Examining data/megahit-1.2.9/src/localasm/local_assemble.cpp Examining data/megahit-1.2.9/src/localasm/local_assemble.h Examining data/megahit-1.2.9/src/localasm/mapping_result_collector.h Examining data/megahit-1.2.9/src/main.cpp Examining data/megahit-1.2.9/src/main_assemble.cpp Examining data/megahit-1.2.9/src/main_buildlib.cpp Examining data/megahit-1.2.9/src/main_iterate.cpp Examining data/megahit-1.2.9/src/main_local_assemble.cpp Examining data/megahit-1.2.9/src/main_sdbg_build.cpp Examining data/megahit-1.2.9/src/parallel_hashmap/meminfo.h Examining data/megahit-1.2.9/src/parallel_hashmap/phmap.h Examining data/megahit-1.2.9/src/parallel_hashmap/phmap_base.h Examining data/megahit-1.2.9/src/parallel_hashmap/phmap_bits.h Examining data/megahit-1.2.9/src/parallel_hashmap/phmap_config.h Examining data/megahit-1.2.9/src/parallel_hashmap/phmap_fwd_decl.h Examining data/megahit-1.2.9/src/parallel_hashmap/phmap_utils.h Examining data/megahit-1.2.9/src/pprintpp/charlist.hpp Examining data/megahit-1.2.9/src/pprintpp/pprintpp.hpp Examining data/megahit-1.2.9/src/pprintpp/stl_symbols.hpp Examining data/megahit-1.2.9/src/pprintpp/typelist.hpp Examining data/megahit-1.2.9/src/sdbg/sdbg.h Examining data/megahit-1.2.9/src/sdbg/sdbg_def.h Examining data/megahit-1.2.9/src/sdbg/sdbg_item.h Examining data/megahit-1.2.9/src/sdbg/sdbg_meta.cpp Examining data/megahit-1.2.9/src/sdbg/sdbg_meta.h Examining data/megahit-1.2.9/src/sdbg/sdbg_raw_content.cpp Examining data/megahit-1.2.9/src/sdbg/sdbg_raw_content.h Examining data/megahit-1.2.9/src/sdbg/sdbg_writer.cpp Examining data/megahit-1.2.9/src/sdbg/sdbg_writer.h Examining data/megahit-1.2.9/src/sequence/copy_substr.h Examining data/megahit-1.2.9/src/sequence/io/async_sequence_reader.h Examining data/megahit-1.2.9/src/sequence/io/base_reader.h Examining data/megahit-1.2.9/src/sequence/io/binary_reader.h Examining data/megahit-1.2.9/src/sequence/io/contig/contig_reader.h Examining data/megahit-1.2.9/src/sequence/io/contig/contig_writer.h Examining data/megahit-1.2.9/src/sequence/io/edge/edge_io_meta.h Examining data/megahit-1.2.9/src/sequence/io/edge/edge_reader.h Examining data/megahit-1.2.9/src/sequence/io/edge/edge_writer.h Examining data/megahit-1.2.9/src/sequence/io/fastx_reader.cpp Examining data/megahit-1.2.9/src/sequence/io/fastx_reader.h Examining data/megahit-1.2.9/src/sequence/io/kseq.h Examining data/megahit-1.2.9/src/sequence/io/paired_fastx_reader.cpp Examining data/megahit-1.2.9/src/sequence/io/paired_fastx_reader.h Examining data/megahit-1.2.9/src/sequence/io/sequence_lib.cpp Examining data/megahit-1.2.9/src/sequence/io/sequence_lib.h Examining data/megahit-1.2.9/src/sequence/kmer.h Examining data/megahit-1.2.9/src/sequence/kmer_plus.h Examining data/megahit-1.2.9/src/sequence/sequence_package.h Examining data/megahit-1.2.9/src/sorting/base_engine.cpp Examining data/megahit-1.2.9/src/sorting/base_engine.h Examining data/megahit-1.2.9/src/sorting/edge_counter.h Examining data/megahit-1.2.9/src/sorting/kmer_counter.cpp Examining data/megahit-1.2.9/src/sorting/kmer_counter.h Examining data/megahit-1.2.9/src/sorting/kmsort_selector.cpp Examining data/megahit-1.2.9/src/sorting/kmsort_selector.h Examining data/megahit-1.2.9/src/sorting/read_to_sdbg.h Examining data/megahit-1.2.9/src/sorting/read_to_sdbg_s1.cpp Examining data/megahit-1.2.9/src/sorting/read_to_sdbg_s2.cpp Examining data/megahit-1.2.9/src/sorting/seq_to_sdbg.cpp Examining data/megahit-1.2.9/src/sorting/seq_to_sdbg.h Examining data/megahit-1.2.9/src/tools/contigs_to_fastg.cpp Examining data/megahit-1.2.9/src/tools/filter_by_len.cpp Examining data/megahit-1.2.9/src/tools/read_stat.cpp Examining data/megahit-1.2.9/src/utils/atomic_wrapper.h Examining data/megahit-1.2.9/src/utils/buffered_reader.h Examining data/megahit-1.2.9/src/utils/cpu_dispatch.h Examining data/megahit-1.2.9/src/utils/histgram.h Examining data/megahit-1.2.9/src/utils/mutex.h Examining data/megahit-1.2.9/src/utils/options_description.cpp Examining data/megahit-1.2.9/src/utils/options_description.h Examining data/megahit-1.2.9/src/utils/utils.h Examining data/megahit-1.2.9/src/xxhash/xxh3.h Examining data/megahit-1.2.9/src/xxhash/xxhash.c Examining data/megahit-1.2.9/src/xxhash/xxhash.h Examining data/megahit-1.2.9/src/xxhash/xxhsum.c FINAL RESULTS: data/megahit-1.2.9/src/pprintpp/pprintpp.hpp:177:25: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. #define pprintf(s, ...) printf(AUTOFORMAT(s, ## __VA_ARGS__), ## __VA_ARGS__) data/megahit-1.2.9/src/pprintpp/pprintpp.hpp:178:29: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. #define pfprintf(f, s, ...) fprintf(f, AUTOFORMAT(s, ## __VA_ARGS__), ## __VA_ARGS__) data/megahit-1.2.9/src/pprintpp/pprintpp.hpp:179:31: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. #define psprintf(str, s, ...) sprintf(str, AUTOFORMAT(s, ## __VA_ARGS__), ## __VA_ARGS__) data/megahit-1.2.9/src/xxhash/xxhsum.c:280:30: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. #define DISPLAY(...) fprintf(stderr, __VA_ARGS__) data/megahit-1.2.9/src/xxhash/xxhsum.c:281:30: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. #define DISPLAYRESULT(...) fprintf(stdout, __VA_ARGS__) data/megahit-1.2.9/src/sorting/seq_to_sdbg.cpp:372:34: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. auto mercy_factor = std::getenv("MEGAHIT_NUM_MERCY_FACTOR"); data/megahit-1.2.9/src/utils/options_description.cpp:63:9: [3] (buffer) getopt_long: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. getopt_long(argc, argv, short_options.c_str(), long_options, &index); data/megahit-1.2.9/src/idba/kmer.h:31: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(data_, kmer.data_, sizeof(uint64_t) * kNumUint64); data/megahit-1.2.9/src/idba/kmer.h:42: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(data_, kmer.data_, sizeof(uint64_t) * kNumUint64); data/megahit-1.2.9/src/parallel_hashmap/meminfo.h:135:21: [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). i = atoi(line); data/megahit-1.2.9/src/parallel_hashmap/meminfo.h:139:21: [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). auto file = fopen("/proc/self/status", "r"); data/megahit-1.2.9/src/parallel_hashmap/meminfo.h:141: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 line[128]; data/megahit-1.2.9/src/parallel_hashmap/phmap.h:452: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(ctrl + capacity + 1, ctrl, Group::kWidth); data/megahit-1.2.9/src/parallel_hashmap/phmap_bits.h:119: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(&t, p, sizeof t); data/megahit-1.2.9/src/parallel_hashmap/phmap_bits.h:125: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(&t, p, sizeof t); data/megahit-1.2.9/src/parallel_hashmap/phmap_bits.h:131: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(&t, p, sizeof t); data/megahit-1.2.9/src/parallel_hashmap/phmap_bits.h:135:53: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. inline void UnalignedStore16(void *p, uint16_t v) { memcpy(p, &v, sizeof v); } data/megahit-1.2.9/src/parallel_hashmap/phmap_bits.h:137:53: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. inline void UnalignedStore32(void *p, uint32_t v) { memcpy(p, &v, sizeof v); } data/megahit-1.2.9/src/parallel_hashmap/phmap_bits.h:139:53: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. inline void UnalignedStore64(void *p, uint64_t v) { memcpy(p, &v, sizeof v); } data/megahit-1.2.9/src/sdbg/sdbg_raw_content.cpp:51:10: [2] (misc) open: 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). is.open((file_prefix + ".sdbg." + std::to_string(bucket_it->file_id)) data/megahit-1.2.9/src/sequence/io/kseq.h:138:7: [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(str->s + str->l, ks->buf + ks->begin, i - ks->begin); \ data/megahit-1.2.9/src/sequence/kmer.h:44:12: [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(data_, seq, sizeof(word_type) * used_words); data/megahit-1.2.9/src/sequence/sequence_package.h:314:3: [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 dna_map_[256]{}; data/megahit-1.2.9/src/tools/contigs_to_fastg.cpp:73:10: [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. static char buf[10240]; data/megahit-1.2.9/src/tools/contigs_to_fastg.cpp:89:16: [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). unsigned k = atoi(argv[1]); data/megahit-1.2.9/src/tools/filter_by_len.cpp:44:22: [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). unsigned min_len = atoi(argv[1]); data/megahit-1.2.9/src/utils/buffered_reader.h:34: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_ptr, buffer_ + head_, remained); data/megahit-1.2.9/src/utils/buffered_reader.h:39:11: [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_ptr, buffer_ + head_, tail_ - head_); data/megahit-1.2.9/src/utils/buffered_reader.h:61:3: [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 buffer_[kMaxBufferSize]{}; data/megahit-1.2.9/src/utils/options_description.cpp:194:27: [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). *(int *)pointer = atoi(value.c_str()); data/megahit-1.2.9/src/utils/utils.h:40:13: [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). if ((fp = fopen(filename, mode)) == nullptr) { data/megahit-1.2.9/src/xxhash/xxhash.c:100:76: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. static void* XXH_memcpy(void* dest, const void* src, size_t size) { return memcpy(dest,src,size); } data/megahit-1.2.9/src/xxhash/xxhash.c:466: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(dstState, srcState, sizeof(*dstState)); data/megahit-1.2.9/src/xxhash/xxhash.c:478: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(statePtr, &state, sizeof(state) - sizeof(state.reserved)); data/megahit-1.2.9/src/xxhash/xxhash.c:578: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, &hash, sizeof(*dst)); data/megahit-1.2.9/src/xxhash/xxhash.c:898: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(dstState, srcState, sizeof(*dstState)); data/megahit-1.2.9/src/xxhash/xxhash.c:910: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(statePtr, &state, sizeof(state) - sizeof(state.reserved)); data/megahit-1.2.9/src/xxhash/xxhash.c:1006: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, &hash, sizeof(*dst)); data/megahit-1.2.9/src/xxhash/xxhash.h:212:27: [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. typedef struct { unsigned char digest[4]; } XXH32_canonical_t; data/megahit-1.2.9/src/xxhash/xxhash.h:247:27: [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. typedef struct { unsigned char digest[8]; } XXH64_canonical_t; data/megahit-1.2.9/src/xxhash/xxhsum.c:457:34: [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* const inFile = fopen( inFileName, "rb" ); data/megahit-1.2.9/src/xxhash/xxhsum.c:847: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(xxhHashValue, &h32, sizeof(h32)); data/megahit-1.2.9/src/xxhash/xxhsum.c:852: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(xxhHashValue, &h64, sizeof(h64)); data/megahit-1.2.9/src/xxhash/xxhsum.c:880:18: [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). inFile = fopen( fileName, "rb" ); data/megahit-1.2.9/src/xxhash/xxhsum.c:1257:14: [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). fp = fopen(parsedLine.filename, "rb"); data/megahit-1.2.9/src/xxhash/xxhsum.c:1363:18: [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). inFile = fopen( inFileName, "rt" ); data/megahit-1.2.9/src/idba/hash_table.h:569:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while (is.read((char *)&value, sizeof(Value))) data/megahit-1.2.9/src/localasm/hash_mapper.cpp:242:22: [1] (buffer) mismatch: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. rec.mismatch = mismatch; \ data/megahit-1.2.9/src/localasm/hash_mapper.h:21:12: [1] (buffer) mismatch: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. uint32_t mismatch; data/megahit-1.2.9/src/localasm/local_assemble.cpp:39:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). for (auto &read : reads) { data/megahit-1.2.9/src/localasm/local_assemble.cpp:40:43: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). max_read_len = std::max(max_read_len, read.size()); data/megahit-1.2.9/src/localasm/local_assemble.cpp:48:16: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). for (auto &read : reads) { data/megahit-1.2.9/src/localasm/local_assemble.cpp:49:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read.size() < kmer_size) continue; data/megahit-1.2.9/src/localasm/local_assemble.cpp:51:26: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). const Sequence seq(read); data/megahit-1.2.9/src/localasm/mapping_result_collector.h:27:33: [1] (buffer) mismatch: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. rec.contig_to, 0, rec.mismatch, rec.strand, rec.query_id)); data/megahit-1.2.9/src/localasm/mapping_result_collector.h:34:70: [1] (buffer) mismatch: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. EncodeMappingRead(contig_len - 1 - rec.contig_from, 0, rec.mismatch, data/megahit-1.2.9/src/localasm/mapping_result_collector.h:51:35: [1] (buffer) mismatch: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. rec1.contig_to, 1, rec1.mismatch, rec1.strand, mate_id)); data/megahit-1.2.9/src/localasm/mapping_result_collector.h:58:72: [1] (buffer) mismatch: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. EncodeMappingRead(contig_len - 1 - rec1.contig_from, 1, rec1.mismatch, data/megahit-1.2.9/src/localasm/mapping_result_collector.h:85:46: [1] (buffer) mismatch: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. uint32_t mismatch, uint8_t strand, data/megahit-1.2.9/src/localasm/mapping_result_collector.h:91:26: [1] (buffer) mismatch: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. ret = (ret << 4u) | (mismatch < 15 ? mismatch : 15u); data/megahit-1.2.9/src/localasm/mapping_result_collector.h:91:42: [1] (buffer) mismatch: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. ret = (ret << 4u) | (mismatch < 15 ? mismatch : 15u); data/megahit-1.2.9/src/parallel_hashmap/meminfo.h:127:26: [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). auto i = strlen(line); data/megahit-1.2.9/src/parallel_hashmap/phmap.h:3124:21: [1] (buffer) equal: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. return std::equal(a.sets_.begin(), a.sets_.end(), b.sets_.begin()); data/megahit-1.2.9/src/sdbg/sdbg_raw_content.cpp:50:17: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). assert(in.read<char>(nullptr) == 0); data/megahit-1.2.9/src/sdbg/sdbg_raw_content.cpp:64:25: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). file_offset += in.read(&item); data/megahit-1.2.9/src/sdbg/sdbg_raw_content.cpp:70:27: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). file_offset += in.read(&mul); data/megahit-1.2.9/src/sdbg/sdbg_raw_content.cpp:83:27: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). file_offset += in.read(tip_label_ptr, metadata.words_per_tip_label()); data/megahit-1.2.9/src/sdbg/sdbg_raw_content.cpp:95:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). assert(in.read<char>(nullptr) == 0); data/megahit-1.2.9/src/sequence/io/binary_reader.h:30:19: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (reader_.read(&read_len) == 0) { data/megahit-1.2.9/src/sequence/io/binary_reader.h:37:33: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). auto bytes_read = reader_.read(buf_.data(), num_words); data/megahit-1.2.9/src/sequence/io/edge/edge_reader.h:134:31: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). auto n_read = cur_reader_.read(buffer_.data(), metadata_.words_per_edge); data/megahit-1.2.9/src/sequence/io/edge/edge_reader.h:146:31: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). auto n_read = cur_reader_.read(buffer_.data(), metadata_.words_per_edge); data/megahit-1.2.9/src/sorting/read_to_sdbg_s2.cpp:148:38: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((size_read = mercy_reader.read(buf, 4096)) > 0) { data/megahit-1.2.9/src/utils/buffered_reader.h:25:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). size_t read(T *dst, size_t size = 1) { data/megahit-1.2.9/src/utils/buffered_reader.h:54:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). is_->read(buffer_, buffer_size_); data/megahit-1.2.9/src/utils/utils.h:71:23: [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). return filename + strlen(rootname) + 1; data/megahit-1.2.9/src/xxhash/xxhsum.c:895:37: [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). { const size_t fileNameSize = strlen(fileName); data/megahit-1.2.9/src/xxhash/xxhsum.c:1045:23: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). const int c = fgetc(inFile); ANALYSIS SUMMARY: Hits = 78 Lines analyzed = 32245 in approximately 0.72 seconds (44489 lines/second) Physical Source Lines of Code (SLOC) = 22788 Hits@level = [0] 3 [1] 32 [2] 39 [3] 2 [4] 5 [5] 0 Hits@level+ = [0+] 81 [1+] 78 [2+] 46 [3+] 7 [4+] 5 [5+] 0 Hits/KSLOC@level+ = [0+] 3.5545 [1+] 3.42285 [2+] 2.01861 [3+] 0.307179 [4+] 0.219414 [5+] 0 Dot directories skipped = 1 (--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.