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/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/storage/storage.cpp Examining data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/storage/common.h Examining data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/storage/storage.h Examining data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/storage/dense/dense.h Examining data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/storage/dense/dense.cpp Examining data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/storage/common.cpp Examining data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/storage/list/list.cpp Examining data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/storage/list/list.h Examining data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/storage/yale/class.h Examining data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/storage/yale/math/transpose.h Examining data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/storage/yale/yale.h Examining data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/storage/yale/yale.cpp Examining data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/storage/yale/iterators/stored_diagonal.h Examining data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/storage/yale/iterators/row_stored_nd.h Examining data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/storage/yale/iterators/base.h Examining data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/storage/yale/iterators/row_stored.h Examining data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/storage/yale/iterators/iterator.h Examining data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/storage/yale/iterators/row.h Examining data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/math/long_dtype.h Examining data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/math/trsm.h Examining data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/math/inc.h Examining data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/math/math.h Examining data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/math/getri.h Examining data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/math/gesdd.h Examining data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/math/potrs.h Examining data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/math/getrs.h Examining data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/math/gemv.h Examining data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/math/asum.h Examining data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/math/nrm2.h Examining data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/math/scal.h Examining data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/math/getf2.h Examining data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/math/laswp.h Examining data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/math/getrf.h Examining data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/math/geev.h Examining data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/math/ger.h Examining data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/math/rotg.h Examining data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/math/idamax.h Examining data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/math/gemm.h Examining data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/math/rot.h Examining data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/math/gesvd.h Examining data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/math/swap.h Examining data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/ruby_nmatrix.c Examining data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/nmatrix.h Examining data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/data/rational.h Examining data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/data/meta.h Examining data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/data/data.cpp Examining data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/data/complex.h Examining data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/data/ruby_object.h Examining data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/data/data.h Examining data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/nmatrix.cpp Examining data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/types.h Examining data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/util/sl_list.cpp Examining data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/util/io.cpp Examining data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/util/sl_list.h Examining data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/util/io.h Examining data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/util/util.h Examining data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/ruby_constants.h Examining data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/math.cpp Examining data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/ruby_constants.cpp Examining data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/nm_memory.h FINAL RESULTS: data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/math.cpp:1638: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(reinterpret_cast<char*>(B) + (i*ldb+j)*element_size, data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/ruby_nmatrix.c:3057: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(shape_copy, shape, sizeof(size_t)*nm_dim); data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/ruby_nmatrix.c:3062: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(elements_copy, elements, DTYPE_SIZES[dtype]*length); data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/storage/dense/dense.cpp:261: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((char*)(s->elements)+i*DTYPE_SIZES[dtype], (char*)(elements)+(i % elements_length)*DTYPE_SIZES[dtype], copy_length*DTYPE_SIZES[dtype]); data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/storage/dense/dense.cpp:379: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(shape_copy, s->shape, sizeof(size_t) * s->dim); data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/storage/dense/dense.cpp:431: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(shape_copy, s->shape, sizeof(size_t) * s->dim); data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/storage/dense/dense.cpp:481: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(shape_copy, s->shape, sizeof(size_t) * s->dim); data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/storage/dense/dense.cpp:531: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(shape_copy, s->shape, sizeof(size_t) * s->dim); data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/storage/dense/dense.cpp:804: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(lhs->elements, rhs->elements, DTYPE_SIZES[rhs->dtype] * count); data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/storage/dense/dense.cpp:938: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(shape, rhs->shape, sizeof(size_t) * rhs->dim); data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/storage/list/list.cpp:110: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(new_shape, shape_, sizeof(size_t)*ref->dim); data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/storage/list/list.cpp:980: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(init_val, &init, sizeof(VALUE)); data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/storage/list/list.cpp:1049: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(init_val, &init, sizeof(VALUE)); data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/storage/list/list.cpp:1136: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(init_val, s->default_val, DTYPE_SIZES[s->dtype]); data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/storage/list/list.cpp:1141: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(shape, slice->lengths, sizeof(size_t) * s->dim); data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/storage/list/list.cpp:1421: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(shape, rhs->shape, sizeof(size_t) * rhs->dim); data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/storage/list/list.cpp:1424: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(init_val, rhs->default_val, DTYPE_SIZES[rhs->dtype]); data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/storage/list/list.cpp:1475: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(shape, rhs->shape, rhs->dim * sizeof(size_t)); data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/storage/storage.cpp:93: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(shape, rhs->shape, rhs->dim * sizeof(size_t)); data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/storage/storage.cpp:280: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(shape, rhs->shape, rhs->dim * sizeof(size_t)); data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/storage/yale/yale.cpp:468: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(new_ija, old_ija, s->capacity * sizeof(IType)); data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/storage/yale/yale.cpp:469: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(new_a, old_a, s->capacity * DTYPE_SIZES[s->dtype]); data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/util/io.cpp:257: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(merge + merge_pos, real + i, len); data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/util/io.cpp:261: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(merge + merge_pos, imag + i, len); data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/util/sl_list.cpp:146: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(val_copy, val, val_size); data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/util/sl_list.cpp:249:15: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. if (copy) memcpy(node->next->val, val, copy_size); data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/util/sl_list.cpp:261: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(val_copy, val, copy_size); data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/util/sl_list.cpp:277: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(copy_val, val, size); data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/nmatrix.cpp:160:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). f.read(reinterpret_cast<char*>(storage->elements), length * sizeof(DType) ); data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/nmatrix.cpp:171:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). f.read( reinterpret_cast<char*>(&(elements[i * length])), (i + 1) * sizeof(DType) ); data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/nmatrix.cpp:185:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). f.read( reinterpret_cast<char*>(&(elements[i * (length + 1)])), (length - i) * sizeof(DType) ); data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/nmatrix.cpp:246:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). f.read(reinterpret_cast<char*>(storage->a), bytes_read); data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/nmatrix.cpp:249:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). f.read(reinterpret_cast<char*>(&padding), bytes_read % 8); data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/nmatrix.cpp:252:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). f.read(reinterpret_cast<char*>(storage->ija), bytes_read); data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/nmatrix.cpp:254:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). f.read(reinterpret_cast<char*>(&padding), bytes_read % 8); data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/ruby_nmatrix.c:1599:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). f.read(reinterpret_cast<char*>(&s), sizeof(size_t)); data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/ruby_nmatrix.c:1810:5: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). f.read(reinterpret_cast<char*>(&fmajor), sizeof(uint16_t)); data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/ruby_nmatrix.c:1811:5: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). f.read(reinterpret_cast<char*>(&fminor), sizeof(uint16_t)); data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/ruby_nmatrix.c:1812:5: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). f.read(reinterpret_cast<char*>(&frelease), sizeof(uint16_t)); data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/ruby_nmatrix.c:1813:5: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). f.read(reinterpret_cast<char*>(&null16), sizeof(uint16_t)); data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/ruby_nmatrix.c:1828:5: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). f.read(reinterpret_cast<char*>(&dt), sizeof(uint8_t)); data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/ruby_nmatrix.c:1829:5: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). f.read(reinterpret_cast<char*>(&st), sizeof(uint8_t)); data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/ruby_nmatrix.c:1830:5: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). f.read(reinterpret_cast<char*>(&it), sizeof(uint8_t)); // FIXME: should tell how few bytes indices are stored as data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/ruby_nmatrix.c:1831:5: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). f.read(reinterpret_cast<char*>(&sm), sizeof(uint8_t)); data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/ruby_nmatrix.c:1832:5: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). f.read(reinterpret_cast<char*>(&null16), sizeof(uint16_t)); data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/ruby_nmatrix.c:1833:5: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). f.read(reinterpret_cast<char*>(&dim), sizeof(uint16_t)); data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/ruby_nmatrix.c:1856:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). f.read(reinterpret_cast<char*>(&ndnz), sizeof(uint32_t)); data/ruby-nmatrix-0.1.0~rc3/ext/nmatrix/ruby_nmatrix.c:1857:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). f.read(reinterpret_cast<char*>(&length), sizeof(uint32_t)); ANALYSIS SUMMARY: Hits = 48 Lines analyzed = 22280 in approximately 0.62 seconds (36044 lines/second) Physical Source Lines of Code (SLOC) = 12226 Hits@level = [0] 4 [1] 20 [2] 28 [3] 0 [4] 0 [5] 0 Hits@level+ = [0+] 52 [1+] 48 [2+] 28 [3+] 0 [4+] 0 [5+] 0 Hits/KSLOC@level+ = [0+] 4.25323 [1+] 3.92606 [2+] 2.2902 [3+] 0 [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.