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/libdeflate-1.6/common/common_defs.h Examining data/libdeflate-1.6/common/compiler_gcc.h Examining data/libdeflate-1.6/common/compiler_msc.h Examining data/libdeflate-1.6/lib/adler32.c Examining data/libdeflate-1.6/lib/adler32_vec_template.h Examining data/libdeflate-1.6/lib/arm/adler32_impl.h Examining data/libdeflate-1.6/lib/arm/cpu_features.c Examining data/libdeflate-1.6/lib/arm/cpu_features.h Examining data/libdeflate-1.6/lib/arm/crc32_impl.h Examining data/libdeflate-1.6/lib/arm/matchfinder_impl.h Examining data/libdeflate-1.6/lib/bt_matchfinder.h Examining data/libdeflate-1.6/lib/crc32.c Examining data/libdeflate-1.6/lib/crc32_table.h Examining data/libdeflate-1.6/lib/crc32_vec_template.h Examining data/libdeflate-1.6/lib/decompress_template.h Examining data/libdeflate-1.6/lib/deflate_compress.c Examining data/libdeflate-1.6/lib/deflate_compress.h Examining data/libdeflate-1.6/lib/deflate_constants.h Examining data/libdeflate-1.6/lib/deflate_decompress.c Examining data/libdeflate-1.6/lib/gzip_compress.c Examining data/libdeflate-1.6/lib/gzip_constants.h Examining data/libdeflate-1.6/lib/gzip_decompress.c Examining data/libdeflate-1.6/lib/hc_matchfinder.h Examining data/libdeflate-1.6/lib/lib_common.h Examining data/libdeflate-1.6/lib/matchfinder_common.h Examining data/libdeflate-1.6/lib/unaligned.h Examining data/libdeflate-1.6/lib/utils.c Examining data/libdeflate-1.6/lib/x86/adler32_impl.h Examining data/libdeflate-1.6/lib/x86/cpu_features.c Examining data/libdeflate-1.6/lib/x86/cpu_features.h Examining data/libdeflate-1.6/lib/x86/crc32_impl.h Examining data/libdeflate-1.6/lib/x86/crc32_pclmul_template.h Examining data/libdeflate-1.6/lib/x86/decompress_impl.h Examining data/libdeflate-1.6/lib/x86/matchfinder_impl.h Examining data/libdeflate-1.6/lib/zlib_compress.c Examining data/libdeflate-1.6/lib/zlib_constants.h Examining data/libdeflate-1.6/lib/zlib_decompress.c Examining data/libdeflate-1.6/libdeflate.h Examining data/libdeflate-1.6/programs/benchmark.c Examining data/libdeflate-1.6/programs/checksum.c Examining data/libdeflate-1.6/programs/gzip.c Examining data/libdeflate-1.6/programs/prog_util.c Examining data/libdeflate-1.6/programs/prog_util.h Examining data/libdeflate-1.6/programs/test_checksums.c Examining data/libdeflate-1.6/programs/test_custom_malloc.c Examining data/libdeflate-1.6/programs/test_incomplete_codes.c Examining data/libdeflate-1.6/programs/test_slow_decompression.c Examining data/libdeflate-1.6/programs/test_trailing_bytes.c Examining data/libdeflate-1.6/programs/test_util.c Examining data/libdeflate-1.6/programs/test_util.h Examining data/libdeflate-1.6/programs/tgetopt.c Examining data/libdeflate-1.6/tools/afl-fuzz/deflate_compress/fuzz.c Examining data/libdeflate-1.6/tools/afl-fuzz/deflate_decompress/fuzz.c Examining data/libdeflate-1.6/tools/afl-fuzz/gzip_decompress/fuzz.c Examining data/libdeflate-1.6/tools/afl-fuzz/zlib_decompress/fuzz.c Examining data/libdeflate-1.6/tools/gen_crc32_multipliers.c Examining data/libdeflate-1.6/tools/gen_crc32_table.c FINAL RESULTS: data/libdeflate-1.6/programs/benchmark.c:352:3: [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. fprintf(fp, "%"TS, all_engines[i]->name); data/libdeflate-1.6/programs/prog_util.c:65:2: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vfprintf(stderr, format, va); data/libdeflate-1.6/programs/prog_util.h:46: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. __attribute__((format(printf, str_idx, args_idx))) data/libdeflate-1.6/programs/test_checksums.c:159:2: [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(rng_seed); data/libdeflate-1.6/programs/test_util.c:65:6: [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. if (getenv("INCLUDE_PERF_TESTS") == NULL) { data/libdeflate-1.6/lib/arm/cpu_features.c:59:7: [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). fd = open("/proc/self/auxv", O_RDONLY); data/libdeflate-1.6/lib/arm/cpu_features.c:65:26: [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. int ret = read(fd, &((char *)auxbuf)[filled], data/libdeflate-1.6/lib/decompress_template.h:205: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(out_next, in_next, len); data/libdeflate-1.6/lib/deflate_compress.c:1673: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(os->next, data, len); data/libdeflate-1.6/lib/deflate_decompress.c:707:6: [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(&decode_table[cur_table_end], data/libdeflate-1.6/lib/deflate_decompress.c:738: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(&decode_table[cur_table_end], data/libdeflate-1.6/lib/lib_common.h:55: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. void *memcpy(void *dest, const void *src, size_t n); data/libdeflate-1.6/lib/lib_common.h:56: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. #define memcpy(dest, src, n) __builtin_memcpy((dest), (src), (n)) data/libdeflate-1.6/lib/unaligned.h:40: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(p, &v, sizeof(v)); \ data/libdeflate-1.6/lib/utils.c:98:8: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. #undef memcpy data/libdeflate-1.6/lib/utils.c:99: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. void *memcpy(void *dest, const void *src, size_t n) data/libdeflate-1.6/lib/utils.c: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. return memcpy(d, s, n); data/libdeflate-1.6/programs/prog_util.h:119:20: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. # define tmemcpy memcpy data/libdeflate-1.6/programs/prog_util.h:120:18: [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). # define topen open data/libdeflate-1.6/programs/test_checksums.c:142: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(guarded_buf_end - len, &buffer[start], len); data/libdeflate-1.6/tools/afl-fuzz/deflate_compress/fuzz.c:13:11: [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). int fd = open(argv[1], O_RDONLY); data/libdeflate-1.6/tools/afl-fuzz/deflate_compress/fuzz.c:19: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 in[stbuf.st_size]; data/libdeflate-1.6/tools/afl-fuzz/deflate_compress/fuzz.c:26: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 out[sizeof(in)]; data/libdeflate-1.6/tools/afl-fuzz/deflate_compress/fuzz.c:27: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 checkarray[sizeof(in)]; data/libdeflate-1.6/tools/afl-fuzz/deflate_decompress/fuzz.c:11:11: [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). int fd = open(argv[1], O_RDONLY); data/libdeflate-1.6/tools/afl-fuzz/deflate_decompress/fuzz.c:17: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 in[stbuf.st_size]; data/libdeflate-1.6/tools/afl-fuzz/deflate_decompress/fuzz.c:21: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 out[sizeof(in) * 3]; data/libdeflate-1.6/tools/afl-fuzz/gzip_decompress/fuzz.c:11:11: [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). int fd = open(argv[1], O_RDONLY); data/libdeflate-1.6/tools/afl-fuzz/gzip_decompress/fuzz.c:17: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 in[stbuf.st_size]; data/libdeflate-1.6/tools/afl-fuzz/gzip_decompress/fuzz.c:21: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 out[sizeof(in) * 3]; data/libdeflate-1.6/tools/afl-fuzz/zlib_decompress/fuzz.c:11:11: [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). int fd = open(argv[1], O_RDONLY); data/libdeflate-1.6/tools/afl-fuzz/zlib_decompress/fuzz.c:17: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 in[stbuf.st_size]; data/libdeflate-1.6/tools/afl-fuzz/zlib_decompress/fuzz.c:21: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 out[sizeof(in) * 3]; data/libdeflate-1.6/lib/arm/cpu_features.c:65:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int ret = read(fd, &((char *)auxbuf)[filled], data/libdeflate-1.6/programs/prog_util.c:237:8: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (getchar() != 'y') { data/libdeflate-1.6/programs/prog_util.c:370:17: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ssize_t res = read(strm->fd, p, MIN(count, INT_MAX)); data/libdeflate-1.6/programs/prog_util.h:92:20: [1] (buffer) wcslen: 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 tstrlen wcslen data/libdeflate-1.6/programs/prog_util.h:123: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). # define tstrlen strlen data/libdeflate-1.6/tools/afl-fuzz/deflate_compress/fuzz.c:20:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = read(fd, in, sizeof in); data/libdeflate-1.6/tools/afl-fuzz/deflate_decompress/fuzz.c:18:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = read(fd, in, sizeof in); data/libdeflate-1.6/tools/afl-fuzz/gzip_decompress/fuzz.c:18:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = read(fd, in, sizeof in); data/libdeflate-1.6/tools/afl-fuzz/zlib_decompress/fuzz.c:18:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = read(fd, in, sizeof in); ANALYSIS SUMMARY: Hits = 42 Lines analyzed = 14036 in approximately 0.47 seconds (30117 lines/second) Physical Source Lines of Code (SLOC) = 8447 Hits@level = [0] 59 [1] 9 [2] 28 [3] 2 [4] 3 [5] 0 Hits@level+ = [0+] 101 [1+] 42 [2+] 33 [3+] 5 [4+] 3 [5+] 0 Hits/KSLOC@level+ = [0+] 11.9569 [1+] 4.97218 [2+] 3.90671 [3+] 0.591926 [4+] 0.355156 [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.