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/bio-eagle-2.4.1/src/DipTreePBWT.cpp Examining data/bio-eagle-2.4.1/src/DipTreePBWT.hpp Examining data/bio-eagle-2.4.1/src/Eagle.cpp Parsing failed to find end of parameter list; semicolon terminated it in ("cM= %.1f (%.1f-%.1f): ", vector <Match> curMatch(1, d1); vector <int> curSign(1, signs[i]); cMs64j[d1.m64jEnd]-cMs64j[d1.m64jStart], cMs64j[d1.m64jStart], cMs64j[d1.m64jEnd]); cout << comp Examining data/bio-eagle-2.4.1/src/Eagle.hpp Examining data/bio-eagle-2.4.1/src/EagleImpMiss.cpp Examining data/bio-eagle-2.4.1/src/EagleMain.cpp Examining data/bio-eagle-2.4.1/src/EaglePBWT.cpp Examining data/bio-eagle-2.4.1/src/EagleParams.cpp Examining data/bio-eagle-2.4.1/src/EagleParams.hpp Examining data/bio-eagle-2.4.1/src/FileUtils.cpp Examining data/bio-eagle-2.4.1/src/FileUtils.hpp Examining data/bio-eagle-2.4.1/src/GenoData.cpp Examining data/bio-eagle-2.4.1/src/GenoData.hpp Examining data/bio-eagle-2.4.1/src/HapHedge.cpp Examining data/bio-eagle-2.4.1/src/HapHedge.hpp Examining data/bio-eagle-2.4.1/src/LapackConst.hpp Examining data/bio-eagle-2.4.1/src/MapInterpolater.cpp Examining data/bio-eagle-2.4.1/src/MapInterpolater.hpp Examining data/bio-eagle-2.4.1/src/MemoryUtils.cpp Examining data/bio-eagle-2.4.1/src/MemoryUtils.hpp Examining data/bio-eagle-2.4.1/src/NumericUtils.cpp Examining data/bio-eagle-2.4.1/src/NumericUtils.hpp Examining data/bio-eagle-2.4.1/src/StaticMultimap.cpp Examining data/bio-eagle-2.4.1/src/StaticMultimap.hpp Examining data/bio-eagle-2.4.1/src/StringUtils.cpp Examining data/bio-eagle-2.4.1/src/StringUtils.hpp Examining data/bio-eagle-2.4.1/src/SyncedVcfData.cpp Examining data/bio-eagle-2.4.1/src/SyncedVcfData.hpp Examining data/bio-eagle-2.4.1/src/Timer.cpp Examining data/bio-eagle-2.4.1/src/Timer.hpp Examining data/bio-eagle-2.4.1/src/Types.hpp Examining data/bio-eagle-2.4.1/src/Version.hpp FINAL RESULTS: data/bio-eagle-2.4.1/src/Eagle.cpp:3542:10: [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. std::srand(1000000*seed + 1000*iter + batch); // seed random_shuffle data/bio-eagle-2.4.1/src/Eagle.cpp:1124:4: [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[20]; sprintf(buf, "[%.1fcM:%d/%d]", cM-lastPhased, hetCount, snpCount); data/bio-eagle-2.4.1/src/Eagle.cpp:1124:18: [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. char buf[20]; sprintf(buf, "[%.1fcM:%d/%d]", cM-lastPhased, hetCount, snpCount); data/bio-eagle-2.4.1/src/Eagle.cpp:1156:2: [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[20]; sprintf(buf, "[%.1fcM:%d/%d]", cM-lastPhased, hetCount, snpCount); data/bio-eagle-2.4.1/src/Eagle.cpp:1156:16: [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. char buf[20]; sprintf(buf, "[%.1fcM:%d/%d]", cM-lastPhased, hetCount, snpCount); data/bio-eagle-2.4.1/src/Eagle.cpp:1197:4: [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[20]; sprintf(buf, "[%.1fcM:%d/%d]", cM-lastPhased, hetCount, snpCount); data/bio-eagle-2.4.1/src/Eagle.cpp:1197:18: [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. char buf[20]; sprintf(buf, "[%.1fcM:%d/%d]", cM-lastPhased, hetCount, snpCount); data/bio-eagle-2.4.1/src/Eagle.cpp:1385:2: [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(runStarts[p], runStarts[!p], N*sizeof(runStarts[p][0])); data/bio-eagle-2.4.1/src/Eagle.cpp:1453:2: [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(runStarts[p][e], runStarts[!p][e], Nhaps*sizeof(runStarts[p][e][0])); data/bio-eagle-2.4.1/src/Eagle.cpp:3101: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). FILE *fout = fopen(tmpPhaseFile.c_str(), "wb"); data/bio-eagle-2.4.1/src/Eagle.cpp:3107: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). FILE *fout = fopen(tmpPhaseFile.c_str(), "rb"); data/bio-eagle-2.4.1/src/Eagle.cpp:3113: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(phaseConfs + 2*n0start*Mseg64*64, phaseConfs2 + 2*n0start*Mseg64*64, data/bio-eagle-2.4.1/src/Eagle.cpp:3118: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(haploBitsT + 2*n0start*Mseg64, tmpHaploBitsT + 2*n0start*Mseg64, data/bio-eagle-2.4.1/src/Eagle.cpp:3530: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(haploBitsT + 2*Nref*Mseg64, tmpHaploBitsT, 2*Ntarget*Mseg64*sizeof(tmpHaploBitsT[0])); data/bio-eagle-2.4.1/src/Eagle.hpp:74: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 switchScoreLut[1<<(3*switchScoreLutBits)][2]; data/bio-eagle-2.4.1/src/EagleImpMiss.cpp:48: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 rmActive[2]; data/bio-eagle-2.4.1/src/EagleImpMiss.cpp:86: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(states, nextStates, std::min(numNext, HAP_BEAM_WIDTH) * sizeof(states[0])); // copy best data/bio-eagle-2.4.1/src/EagleImpMiss.cpp:92: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[100]; data/bio-eagle-2.4.1/src/EagleImpMiss.cpp:93:5: [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. sprintf(buf, "%.2fe%d", pow(10, f - floor(f)), (int) floor(f)); data/bio-eagle-2.4.1/src/FileUtils.cpp:42:12: [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). stream.open(file.c_str(), mode); data/bio-eagle-2.4.1/src/FileUtils.cpp:50:12: [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). stream.open(file.c_str(), mode); data/bio-eagle-2.4.1/src/FileUtils.cpp:59:9: [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). fin.open(file.c_str()); data/bio-eagle-2.4.1/src/FileUtils.cpp:73: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). fout.open(file.c_str(), std::ios::out|std::ios::app); data/bio-eagle-2.4.1/src/FileUtils.cpp:138:9: [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). fin.open(file.c_str(), mode); data/bio-eagle-2.4.1/src/FileUtils.cpp:188: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). fout.open(file.c_str(), mode); data/bio-eagle-2.4.1/src/GenoData.cpp:49:35: [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). if (isdigit(chrom[0])) return atoi(chrom.c_str()); data/bio-eagle-2.4.1/src/HapHedge.cpp:475: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(a1, a, u * sizeof(a1[0])); memcpy(a1+u, b, v * sizeof(a1[0])); data/bio-eagle-2.4.1/src/HapHedge.cpp:475:41: [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(a1, a, u * sizeof(a1[0])); memcpy(a1+u, b, v * sizeof(a1[0])); data/bio-eagle-2.4.1/src/HapHedge.cpp:476: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(d1, d, u * sizeof(d1[0])); memcpy(d1+u, e, v * sizeof(d1[0])); data/bio-eagle-2.4.1/src/HapHedge.cpp:476:41: [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(d1, d, u * sizeof(d1[0])); memcpy(d1+u, e, v * sizeof(d1[0])); data/bio-eagle-2.4.1/src/HapHedge.cpp:567: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(ad+u, ad1, v * sizeof(ad[0])); data/bio-eagle-2.4.1/src/Eagle.cpp:325:11: [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. if (mismatch || m64j==m64jLast) { // end of IBDx2 segment data/bio-eagle-2.4.1/src/Eagle.cpp:498:6: [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. if (mismatch || m64j==m64jLast) { // end of IBDx2 segment data/bio-eagle-2.4.1/src/EagleMain.cpp:227:9: [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). if (strlen(argv[i]) >= 2 && argv[i][0] == '-' && argv[i][1] == '-') data/bio-eagle-2.4.1/src/EagleMain.cpp:230: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). for (uint j = 0; j < strlen(argv[i]); j++) data/bio-eagle-2.4.1/src/EagleMain.cpp:236: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). for (uint j = 0; j < strlen(argv[i]); j++) { data/bio-eagle-2.4.1/src/FileUtils.cpp:157:35: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). AutoGzIfstream& AutoGzIfstream::read(char *s, std::streamsize n) { data/bio-eagle-2.4.1/src/FileUtils.cpp:158:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). boost_in.read(s, n); data/bio-eagle-2.4.1/src/FileUtils.hpp:67:21: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). AutoGzIfstream& read(char *s, std::streamsize n); data/bio-eagle-2.4.1/src/GenoData.cpp:576:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). fin.read((char *) header, 3); data/bio-eagle-2.4.1/src/GenoData.cpp:825:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). fin.read((char *) bedLineIn, (Nbed+3)>>2); data/bio-eagle-2.4.1/src/StringUtils.cpp:134:9: [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). if (strlen(nameBuf)>3 && data/bio-eagle-2.4.1/src/StringUtils.cpp:137:15: [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). if ((int) strlen(nameBuf) == startPos + 1 && toupper(nameBuf[startPos])=='X') ANALYSIS SUMMARY: Hits = 43 Lines analyzed = 10429 in approximately 0.39 seconds (26823 lines/second) Physical Source Lines of Code (SLOC) = 7936 Hits@level = [0] 55 [1] 12 [2] 30 [3] 1 [4] 0 [5] 0 Hits@level+ = [0+] 98 [1+] 43 [2+] 31 [3+] 1 [4+] 0 [5+] 0 Hits/KSLOC@level+ = [0+] 12.3488 [1+] 5.41835 [2+] 3.90625 [3+] 0.126008 [4+] 0 [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.