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/fparserc++-4.5.2/examples/example.cc Examining data/fparserc++-4.5.2/examples/example2.cc Examining data/fparserc++-4.5.2/fparser.cc Examining data/fparserc++-4.5.2/fpoptimizer/bytecodesynth.cc Examining data/fparserc++-4.5.2/fpoptimizer/codetree.cc Examining data/fparserc++-4.5.2/fpoptimizer/constantfolding.cc Examining data/fparserc++-4.5.2/fpoptimizer/cse.cc Examining data/fparserc++-4.5.2/fpoptimizer/debug.cc Examining data/fparserc++-4.5.2/fpoptimizer/grammar.cc Examining data/fparserc++-4.5.2/fpoptimizer/grammar_data.cc Examining data/fparserc++-4.5.2/fpoptimizer/hash.cc Examining data/fparserc++-4.5.2/fpoptimizer/makebytecode.cc Examining data/fparserc++-4.5.2/fpoptimizer/opcodename.cc Examining data/fparserc++-4.5.2/fpoptimizer/optimize.cc Examining data/fparserc++-4.5.2/fpoptimizer/optimize_debug.cc Examining data/fparserc++-4.5.2/fpoptimizer/optimize_main.cc Examining data/fparserc++-4.5.2/fpoptimizer/optimize_match.cc Examining data/fparserc++-4.5.2/fpoptimizer/optimize_synth.cc Examining data/fparserc++-4.5.2/fpoptimizer/rangeestimation.cc Examining data/fparserc++-4.5.2/fpoptimizer/readbytecode.cc Examining data/fparserc++-4.5.2/fpoptimizer/transformations.cc Examining data/fparserc++-4.5.2/fpoptimizer/valuerange.cc Examining data/fparserc++-4.5.2/mpfr/GmpInt.cc Examining data/fparserc++-4.5.2/mpfr/MpfrFloat.cc Examining data/fparserc++-4.5.2/testbed.cc Examining data/fparserc++-4.5.2/tests/make_tests.cc Examining data/fparserc++-4.5.2/util/bytecoderules_parser.cc Examining data/fparserc++-4.5.2/util/cpp_compress.cc Examining data/fparserc++-4.5.2/util/cpp_compress_main.cc Examining data/fparserc++-4.5.2/util/create_testrules_for_optimization_rules.cc Examining data/fparserc++-4.5.2/util/ftest.cc Examining data/fparserc++-4.5.2/util/functioninfo.cc Examining data/fparserc++-4.5.2/util/make_function_name_parser.cc Examining data/fparserc++-4.5.2/util/powi_opt.cc Examining data/fparserc++-4.5.2/util/powi_speedtest.cc Examining data/fparserc++-4.5.2/util/speedtest.cc Examining data/fparserc++-4.5.2/util/tree_grammar_parser.cc Examining data/fparserc++-4.5.2/util/version_changer.cc FINAL RESULTS: data/fparserc++-4.5.2/util/tree_grammar_parser.cc:1872:21: [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 YYFPRINTF fprintf data/fparserc++-4.5.2/fparser.cc:700: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(namebuf, newName.first.name, newName.first.nameLength); data/fparserc++-4.5.2/fparser.cc:764: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(const_cast<char*>(tmp.first.name), i->first.name, data/fparserc++-4.5.2/fparser.cc:1436:20: [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. const unsigned char powi_factor_table[128] = data/fparserc++-4.5.2/fpoptimizer/bytecodesynth.cc:102: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. unsigned char powi_table[POWI_TABLE_SIZE]; data/fparserc++-4.5.2/fpoptimizer/bytecodesynth.cc:105: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. unsigned char powi_table[POWI_TABLE_SIZE] = data/fparserc++-4.5.2/fpoptimizer/hash.cc:81:30: [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. unsigned char filler1[16]; data/fparserc++-4.5.2/fpoptimizer/hash.cc:83:30: [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. unsigned char filler2[16]; data/fparserc++-4.5.2/fpoptimizer/hash.cc:87:30: [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. unsigned char filler3[sizeof(Value_t)+16-sizeof(fphash_value_t)]; data/fparserc++-4.5.2/fpoptimizer/optimize_match.cc:125:18: [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(this, &b, sizeof(b)); data/fparserc++-4.5.2/fpoptimizer/optimize_match.cc:129:18: [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(this, &b, sizeof(b)); data/fparserc++-4.5.2/fpoptimizer/transformations.cc:24: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. extern const unsigned char powi_table[256]; data/fparserc++-4.5.2/mpfr/GmpInt.cc:258: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(&dest_mpz_t, mData->mInteger, sizeof(mpz_t)); data/fparserc++-4.5.2/mpfr/MpfrFloat.cc:403: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(&dest_mpfr_t, mData->mFloat, sizeof(mpfr_t)); data/fparserc++-4.5.2/testbed.cc:2841:47: [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(i+1 < argc) runAlgoTest = std::atoi(argv[++i]); data/fparserc++-4.5.2/tests/make_tests.cc:378: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. char MacroName[32], *m = MacroName; data/fparserc++-4.5.2/tests/make_tests.cc:666: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[4096]={0}; data/fparserc++-4.5.2/tests/make_tests.cc:993:30: [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). outputFileStream.open(argv[a]); data/fparserc++-4.5.2/tests/make_tests.cc:1018:25: [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* fp = std::fopen(files[a].c_str(), "rt"); data/fparserc++-4.5.2/util/bytecoderules_parser.cc:241: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 result[16] = {0}; data/fparserc++-4.5.2/util/bytecoderules_parser.cc:1136: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 Buf[2048]; data/fparserc++-4.5.2/util/cpp_compress.cc:778: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* fp = fopen("cpp_compress_disable", "r"); data/fparserc++-4.5.2/util/cpp_compress_main.cc:10: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[32768]; data/fparserc++-4.5.2/util/functioninfo.cc:1286:33: [2] (integer) atol: 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). mantissaBits = std::atol(argv[i]); data/fparserc++-4.5.2/util/tree_grammar_parser.cc:2169: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 const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; data/fparserc++-4.5.2/util/tree_grammar_parser.cc:2416: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 yymsgbuf[128]; data/fparserc++-4.5.2/fparser.cc:1348:20: [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 int(strlen(Function)); data/fparserc++-4.5.2/testbed.cc:2934:22: [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). else if(std::strlen(argv[i]) > 0) data/fparserc++-4.5.2/util/cpp_compress.cc:654:38: [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. if (std::equal( data/fparserc++-4.5.2/util/cpp_compress.cc:697:30: [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. if (std::equal(sequence.begin(), data/fparserc++-4.5.2/util/make_function_name_parser.cc:33:22: [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). && length == strlen(Functions[a].name)) data/fparserc++-4.5.2/util/make_function_name_parser.cc:46:12: [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(Functions[a].name) != length) continue; data/fparserc++-4.5.2/util/make_function_name_parser.cc:47:12: [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(Functions[a].name) < prefix.size()) continue; data/fparserc++-4.5.2/util/make_function_name_parser.cc:56:16: [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(Functions[a].name) != length) continue; data/fparserc++-4.5.2/util/make_function_name_parser.cc:57:16: [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(Functions[a].name) < prefix.size()) continue; data/fparserc++-4.5.2/util/make_function_name_parser.cc:104:12: [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(Functions[a].name) != length) continue; data/fparserc++-4.5.2/util/make_function_name_parser.cc:105:12: [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(Functions[a].name) <= prefix.size()) continue; data/fparserc++-4.5.2/util/make_function_name_parser.cc:161: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). lengthSet.insert(strlen(Functions[a].name)); data/fparserc++-4.5.2/util/tree_grammar_parser.cc:2054:21: [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). # define yystrlen strlen data/fparserc++-4.5.2/util/tree_grammar_parser.cc:3145:22: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int c = std::fgetc(stdin); data/fparserc++-4.5.2/util/tree_grammar_parser.cc:3154:18: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int c = std::fgetc(stdin); data/fparserc++-4.5.2/util/tree_grammar_parser.cc:3159:51: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while(c != EOF && c != '\n') c = std::fgetc(stdin); data/fparserc++-4.5.2/util/tree_grammar_parser.cc:3163:22: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). c = std::fgetc(stdin); data/fparserc++-4.5.2/util/tree_grammar_parser.cc:3172:22: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). c = std::fgetc(stdin); data/fparserc++-4.5.2/util/tree_grammar_parser.cc:3179:22: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). c = std::fgetc(stdin); data/fparserc++-4.5.2/util/tree_grammar_parser.cc:3186:27: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int c2 = std::fgetc(stdin); data/fparserc++-4.5.2/util/tree_grammar_parser.cc:3202:27: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int c2 = std::fgetc(stdin); data/fparserc++-4.5.2/util/tree_grammar_parser.cc:3223:27: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int c2 = std::fgetc(stdin); data/fparserc++-4.5.2/util/tree_grammar_parser.cc:3248:26: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). c = std::fgetc(stdin); data/fparserc++-4.5.2/util/tree_grammar_parser.cc:3252:22: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). c = std::fgetc(stdin); data/fparserc++-4.5.2/util/tree_grammar_parser.cc:3265:26: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). c = std::fgetc(stdin); data/fparserc++-4.5.2/util/tree_grammar_parser.cc:3275:22: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). std::fgetc(stdin); data/fparserc++-4.5.2/util/tree_grammar_parser.cc:3286:30: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). c = std::fgetc(stdin); data/fparserc++-4.5.2/util/tree_grammar_parser.cc:3295:26: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). std::fgetc(stdin); data/fparserc++-4.5.2/util/tree_grammar_parser.cc:3315:26: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). c = std::fgetc(stdin); data/fparserc++-4.5.2/util/tree_grammar_parser.cc:3503:22: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int c = std::fgetc(stdin); data/fparserc++-4.5.2/util/tree_grammar_parser.cc:3513:22: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). c = std::fgetc(stdin); data/fparserc++-4.5.2/util/tree_grammar_parser.cc:3524:22: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int c = std::fgetc(stdin); data/fparserc++-4.5.2/util/tree_grammar_parser.cc:3527:29: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). { do { c = std::fgetc(stdin); } while(!(c == '\n' || c == EOF)); data/fparserc++-4.5.2/util/tree_grammar_parser.cc:3534:26: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). c = std::fgetc(stdin); data/fparserc++-4.5.2/util/tree_grammar_parser.cc:3551:26: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). c = std::fgetc(stdin); ANALYSIS SUMMARY: Hits = 61 Lines analyzed = 28273 in approximately 3.13 seconds (9041 lines/second) Physical Source Lines of Code (SLOC) = 22741 Hits@level = [0] 48 [1] 35 [2] 25 [3] 0 [4] 1 [5] 0 Hits@level+ = [0+] 109 [1+] 61 [2+] 26 [3+] 1 [4+] 1 [5+] 0 Hits/KSLOC@level+ = [0+] 4.7931 [1+] 2.68238 [2+] 1.14331 [3+] 0.0439734 [4+] 0.0439734 [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.