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/guetzli-1.0.1/guetzli/butteraugli_comparator.cc Examining data/guetzli-1.0.1/guetzli/butteraugli_comparator.h Examining data/guetzli-1.0.1/guetzli/color_transform.h Examining data/guetzli-1.0.1/guetzli/comparator.h Examining data/guetzli-1.0.1/guetzli/dct_double.cc Examining data/guetzli-1.0.1/guetzli/dct_double.h Examining data/guetzli-1.0.1/guetzli/debug_print.cc Examining data/guetzli-1.0.1/guetzli/debug_print.h Examining data/guetzli-1.0.1/guetzli/entropy_encode.cc Examining data/guetzli-1.0.1/guetzli/entropy_encode.h Examining data/guetzli-1.0.1/guetzli/fast_log.h Examining data/guetzli-1.0.1/guetzli/fdct.cc Examining data/guetzli-1.0.1/guetzli/fdct.h Examining data/guetzli-1.0.1/guetzli/gamma_correct.cc Examining data/guetzli-1.0.1/guetzli/gamma_correct.h Examining data/guetzli-1.0.1/guetzli/guetzli.cc Examining data/guetzli-1.0.1/guetzli/idct.cc Examining data/guetzli-1.0.1/guetzli/idct.h Examining data/guetzli-1.0.1/guetzli/jpeg_bit_writer.h Examining data/guetzli-1.0.1/guetzli/jpeg_data.cc Examining data/guetzli-1.0.1/guetzli/jpeg_data.h Examining data/guetzli-1.0.1/guetzli/jpeg_data_decoder.cc Examining data/guetzli-1.0.1/guetzli/jpeg_data_decoder.h Examining data/guetzli-1.0.1/guetzli/jpeg_data_encoder.cc Examining data/guetzli-1.0.1/guetzli/jpeg_data_encoder.h Examining data/guetzli-1.0.1/guetzli/jpeg_data_reader.cc Examining data/guetzli-1.0.1/guetzli/jpeg_data_reader.h Examining data/guetzli-1.0.1/guetzli/jpeg_data_writer.cc Examining data/guetzli-1.0.1/guetzli/jpeg_data_writer.h Examining data/guetzli-1.0.1/guetzli/jpeg_error.h Examining data/guetzli-1.0.1/guetzli/jpeg_huffman_decode.cc Examining data/guetzli-1.0.1/guetzli/jpeg_huffman_decode.h Examining data/guetzli-1.0.1/guetzli/output_image.cc Examining data/guetzli-1.0.1/guetzli/output_image.h Examining data/guetzli-1.0.1/guetzli/preprocess_downsample.cc Examining data/guetzli-1.0.1/guetzli/preprocess_downsample.h Examining data/guetzli-1.0.1/guetzli/processor.cc Examining data/guetzli-1.0.1/guetzli/processor.h Examining data/guetzli-1.0.1/guetzli/quality.cc Examining data/guetzli-1.0.1/guetzli/quality.h Examining data/guetzli-1.0.1/guetzli/quantize.cc Examining data/guetzli-1.0.1/guetzli/quantize.h Examining data/guetzli-1.0.1/guetzli/score.cc Examining data/guetzli-1.0.1/guetzli/score.h Examining data/guetzli-1.0.1/guetzli/stats.h Examining data/guetzli-1.0.1/third_party/butteraugli/butteraugli/butteraugli.cc Examining data/guetzli-1.0.1/third_party/butteraugli/butteraugli/butteraugli.h Examining data/guetzli-1.0.1/third_party/butteraugli/butteraugli/butteraugli_main.cc FINAL RESULTS: data/guetzli-1.0.1/guetzli/debug_print.h:31: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(debug_string, sizeof(debug_string), __VA_ARGS__); \ data/guetzli-1.0.1/guetzli/debug_print.h:30: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 debug_string[1024]; \ data/guetzli-1.0.1/guetzli/guetzli.cc:117: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(row_out, row_in, 3 * (*xsize)); data/guetzli-1.0.1/guetzli/guetzli.cc:214:17: [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). quality = atoi(argv[opt_idx]); data/guetzli-1.0.1/guetzli/guetzli.cc:217: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). memlimit_mb = atoi(argv[opt_idx]); data/guetzli-1.0.1/guetzli/guetzli.cc:230: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* fin = fopen(argv[opt_idx], "rb"); data/guetzli-1.0.1/guetzli/guetzli.cc:292: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* fout = fopen(argv[opt_idx + 1], "wb"); data/guetzli-1.0.1/guetzli/jpeg_data.cc:87: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(&table.values[0], &q[i][0], kTableSize); data/guetzli-1.0.1/guetzli/jpeg_data_encoder.cc: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(&jpg->components[i].coeffs[block_ix * kDCTBlockSize], data/guetzli-1.0.1/guetzli/jpeg_data_writer.cc:325: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(&depth[second_last * JpegHistogram::kSize], depth_combined, data/guetzli-1.0.1/guetzli/output_image.cc:64: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(block, &coeffs_[offset], kDCTBlockSize * sizeof(coeffs_[0])); data/guetzli-1.0.1/guetzli/output_image.cc:128: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(&coeffs_[offset], block, kDCTBlockSize * sizeof(coeffs_[0])); data/guetzli-1.0.1/guetzli/output_image.cc:369: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(&q[c][0], components_[c].quant(), kDCTBlockSize * sizeof(q[0][0])); data/guetzli-1.0.1/guetzli/output_image.cc:443: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 buf[128]; data/guetzli-1.0.1/guetzli/processor.cc:85: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(&q_in[i][0], q, kDCTBlockSize * sizeof(q[0])); data/guetzli-1.0.1/guetzli/processor.cc:491: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(&(*depths)[i * JpegHistogram::kSize], data/guetzli-1.0.1/guetzli/processor.cc:550: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(&orig_block[c * kDCTBlockSize], data/guetzli-1.0.1/third_party/butteraugli/butteraugli/butteraugli.cc:61: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(aligned - kPointerSize, &allocated, kPointerSize); data/guetzli-1.0.1/third_party/butteraugli/butteraugli/butteraugli.cc:72: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(&allocated, aligned - kPointerSize, kPointerSize); data/guetzli-1.0.1/third_party/butteraugli/butteraugli/butteraugli.h:322: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(to, from, other.ysize() * other.bytes_per_row()); data/guetzli-1.0.1/third_party/butteraugli/butteraugli/butteraugli.h:352: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(row_to, row_from, xsize * sizeof(T)); data/guetzli-1.0.1/third_party/butteraugli/butteraugli/butteraugli.h:365: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(row_to, row_from, xsize * sizeof(T)); data/guetzli-1.0.1/third_party/butteraugli/butteraugli/butteraugli_main.cc:279: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). FILE* f = fopen(filename, "r"); data/guetzli-1.0.1/third_party/butteraugli/butteraugli/butteraugli_main.cc:284:12: [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 magic[2]; data/guetzli-1.0.1/third_party/butteraugli/butteraugli/butteraugli_main.cc:412:24: [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 fmap = fopen(argv[3], "wb"); ANALYSIS SUMMARY: Hits = 25 Lines analyzed = 9606 in approximately 0.33 seconds (28792 lines/second) Physical Source Lines of Code (SLOC) = 7328 Hits@level = [0] 84 [1] 0 [2] 24 [3] 0 [4] 1 [5] 0 Hits@level+ = [0+] 109 [1+] 25 [2+] 25 [3+] 1 [4+] 1 [5+] 0 Hits/KSLOC@level+ = [0+] 14.8745 [1+] 3.41157 [2+] 3.41157 [3+] 0.136463 [4+] 0.136463 [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.