The following issues were found
numpy/f2py/__main__.py
1 issues
Line: 1
Column: 1
# See http://cens.ioc.ee/projects/f2py2e/
from numpy.f2py.f2py2e import main
main()
Reported by Pylint.
numpy/core/src/multiarray/_datetime.h
1 issues
Line: 4
Column: 22
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
#ifndef _NPY_PRIVATE__DATETIME_H_
#define _NPY_PRIVATE__DATETIME_H_
extern NPY_NO_EXPORT char const *_datetime_strings[NPY_DATETIME_NUMUNITS];
extern NPY_NO_EXPORT int _days_per_month_table[2][12];
NPY_NO_EXPORT void
numpy_pydatetime_import(void);
Reported by FlawFinder.
numpy/random/src/mt19937/randomkit.h
1 issues
Line: 106
Column: 8
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
} rk_error;
/* error strings */
extern char *rk_strerror[RK_ERR_MAX];
/* Maximum generated random value */
#define RK_MAX 0xFFFFFFFFUL
#ifdef __cplusplus
Reported by FlawFinder.
numpy/random/_examples/cython/setup.py
1 issues
Line: 11
Column: 1
from os.path import dirname, join, abspath
import numpy as np
from Cython.Build import cythonize
from numpy.distutils.misc_util import get_info
from setuptools.extension import Extension
path = dirname(__file__)
src_dir = join(dirname(path), '..', 'src')
Reported by Pylint.
numpy/doc/__init__.py
1 issues
Line: 11
Column: 5
for f in __all__:
__import__(__name__ + '.' + f)
del f, ref_dir
__doc__ = """\
Topical documentation
=====================
Reported by Pylint.
numpy/core/src/multiarray/alloc.c
1 issues
Line: 228
*old_data = _PyDataMem_eventhook_user_data;
}
_PyDataMem_eventhook_user_data = user_data;
NPY_DISABLE_C_API
return temp;
}
/*NUMPY_API
* Allocates memory for array data.
Reported by Cppcheck.
numpy/core/src/multiarray/calculation.c
1 issues
Line: 114
Column: 13
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
* While `ap` may be transposed, we can ignore this for `out` because the
* transpose only reorders the size 1 `axis` (not changing memory layout).
*/
memcpy(out_shape, original_op_shape, out_ndim * sizeof(npy_intp));
out_shape[axis] = 1;
}
}
if (is_argmax) {
Reported by FlawFinder.
numpy/core/src/multiarray/common_dtype.c
1 issues
Line: 229
Column: 5
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
dtypes = (PyArray_DTypeMeta **)_scratch_heap;
}
memcpy(dtypes, dtypes_in, length * sizeof(PyObject *));
/*
* `result` is the last promotion result, which can usually be reused if
* it is not NotImplemneted.
* The passed in dtypes are partially sorted (and cleared, when clearly
Reported by FlawFinder.
numpy/core/src/multiarray/iterators.c
1 issues
Line: 1535
Column: 9
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
}
if (PyArray_ISOBJECT(ar->ao)) {
memcpy(ret, PyArray_DATA(fill), sizeof(PyObject*));
Py_INCREF(*(PyObject**)ret);
} else {
/* Non-object types */
storeflags = PyArray_FLAGS(ar->ao);
Reported by FlawFinder.
numpy/core/src/multiarray/number.h
1 issues
Line: 28
Column: 15
CWE codes:
126
Suggestion:
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
PyObject *bitwise_or;
PyObject *less;
PyObject *less_equal;
PyObject *equal;
PyObject *not_equal;
PyObject *greater;
PyObject *greater_equal;
PyObject *floor_divide;
PyObject *true_divide;
Reported by FlawFinder.