The following issues were found
numpy/random/src/philox/philox-test-data-gen.c
2 issues
Line: 42
Column: 8
CWE codes:
362
}
FILE *fp;
fp = fopen("philox-testset-1.csv", "w");
if (fp == NULL) {
printf("Couldn't open file\n");
return -1;
}
fprintf(fp, "seed, 0x%" PRIx64 "\n", seed);
Reported by FlawFinder.
Line: 69
Column: 8
CWE codes:
362
}
}
fp = fopen("philox-testset-2.csv", "w");
if (fp == NULL) {
printf("Couldn't open file\n");
return -1;
}
fprintf(fp, "seed, 0x%" PRIx64 "\n", seed);
Reported by FlawFinder.
doc/source/user/plot_gray_svd.py
2 issues
Line: 1
Column: 1
from scipy import misc
import matplotlib.pyplot as plt
import numpy as np
from numpy import linalg
img = misc.face()
img_array = img / 255
img_gray = img_array @ [0.2126, 0.7152, 0.0722]
Reported by Pylint.
Line: 1
Column: 1
from scipy import misc
import matplotlib.pyplot as plt
import numpy as np
from numpy import linalg
img = misc.face()
img_array = img / 255
img_gray = img_array @ [0.2126, 0.7152, 0.0722]
Reported by Pylint.
numpy/random/src/mt19937/mt19937-test-data-gen.c
2 issues
Line: 27
Column: 8
CWE codes:
362
}
FILE *fp;
fp = fopen("mt19937-testset-1.csv", "w");
if (fp == NULL) {
printf("Couldn't open file\n");
return -1;
}
fprintf(fp, "seed, 0x%" PRIx32 "\n", seed);
Reported by FlawFinder.
Line: 46
Column: 8
CWE codes:
362
for (i = 0; i < N; i++) {
store[i] = (uint64_t)rk_random(&state);
}
fp = fopen("mt19937-testset-2.csv", "w");
if (fp == NULL) {
printf("Couldn't open file\n");
return -1;
}
fprintf(fp, "seed, 0x%" PRIx32 "\n", seed);
Reported by FlawFinder.
numpy/version.py
2 issues
Line: 1
Column: 1
from ._version import get_versions
__ALL__ = ['version', 'full_version', 'git_revision', 'release']
vinfo = get_versions()
version: str = vinfo["version"]
full_version: str = vinfo['version']
git_revision: str = vinfo['full-revisionid']
release = 'dev0' not in version and '+' not in version
Reported by Pylint.
Line: 1
Column: 1
from ._version import get_versions
__ALL__ = ['version', 'full_version', 'git_revision', 'release']
vinfo = get_versions()
version: str = vinfo["version"]
full_version: str = vinfo['version']
git_revision: str = vinfo['full-revisionid']
release = 'dev0' not in version and '+' not in version
Reported by Pylint.
numpy/core/code_generators/numpy_api.py
2 issues
Line: 16
Column: 1
exception, so it should hopefully not get unnoticed).
"""
from code_generators.genapi import StealRef, NonNull
# index, type
multiarray_global_vars = {
'NPY_NUMUSERTYPES': (7, 'int'),
'NPY_DEFAULT_ASSIGN_CASTING': (292, 'NPY_CASTING'),
Reported by Pylint.
Line: 410
Column: 3
}
# List of all the dicts which define the C API
# XXX: DO NOT CHANGE THE ORDER OF TUPLES BELOW !
multiarray_api = (
multiarray_global_vars,
multiarray_scalar_bool_values,
multiarray_types_api,
multiarray_funcs_api,
Reported by Pylint.
numpy/core/cversions.py
2 issues
Line: 8
Column: 1
"""
from os.path import dirname
from code_generators.genapi import fullapi_hash
from code_generators.numpy_api import full_api
if __name__ == '__main__':
curdir = dirname(__file__)
print(fullapi_hash(full_api))
Reported by Pylint.
Line: 9
Column: 1
from os.path import dirname
from code_generators.genapi import fullapi_hash
from code_generators.numpy_api import full_api
if __name__ == '__main__':
curdir = dirname(__file__)
print(fullapi_hash(full_api))
Reported by Pylint.
numpy/typing/tests/data/fail/lib_version.py
2 issues
Line: 6
Column: 1
version: NumpyVersion
NumpyVersion(b"1.8.0") # E: incompatible type
version >= b"1.8.0" # E: Unsupported operand types
Reported by Pylint.
Line: 1
Column: 1
from numpy.lib import NumpyVersion
version: NumpyVersion
NumpyVersion(b"1.8.0") # E: incompatible type
version >= b"1.8.0" # E: Unsupported operand types
Reported by Pylint.
tools/allocation_tracking/setup.py
2 issues
Line: 3
Column: 1
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
import numpy
setup(
cmdclass = {'build_ext': build_ext},
ext_modules = [Extension("alloc_hook", ["alloc_hook.pyx"],
include_dirs=[numpy.get_include()])])
Reported by Pylint.
Line: 1
Column: 1
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
import numpy
setup(
cmdclass = {'build_ext': build_ext},
ext_modules = [Extension("alloc_hook", ["alloc_hook.pyx"],
include_dirs=[numpy.get_include()])])
Reported by Pylint.
numpy/core/src/multiarray/array_assign_array.c
2 issues
Line: 135
Column: 9
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
NPY_RAW_ITER_START(idim, ndim, coord, shape_it) {
/* Process the innermost dimension */
char *args[2] = {src_data, dst_data};
if (cast_info.func(&cast_info.context,
args, &shape_it[0], strides, cast_info.auxdata) < 0) {
goto fail;
}
} NPY_RAW_ITER_TWO_NEXT(idim, ndim, coord, shape_it,
Reported by FlawFinder.
Line: 230
Column: 9
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
stransfer = (PyArray_MaskedStridedUnaryOp *)cast_info.func;
/* Process the innermost dimension */
char *args[2] = {src_data, dst_data};
if (stransfer(&cast_info.context,
args, &shape_it[0], strides,
(npy_bool *)wheremask_data, wheremask_strides_it[0],
cast_info.auxdata) < 0) {
break;
Reported by FlawFinder.
numpy/core/src/multiarray/array_assign_scalar.c
2 issues
Line: 85
Column: 9
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
NPY_RAW_ITER_START(idim, ndim, coord, shape_it) {
/* Process the innermost dimension */
char *args[2] = {src_data, dst_data};
if (cast_info.func(&cast_info.context,
args, &shape_it[0], strides, cast_info.auxdata) < 0) {
goto fail;
}
} NPY_RAW_ITER_ONE_NEXT(idim, ndim, coord,
Reported by FlawFinder.
Line: 168
Column: 9
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
PyArray_MaskedStridedUnaryOp *stransfer;
stransfer = (PyArray_MaskedStridedUnaryOp *)cast_info.func;
char *args[2] = {src_data, dst_data};
if (stransfer(&cast_info.context,
args, &shape_it[0], strides,
(npy_bool *)wheremask_data, wheremask_strides_it[0],
cast_info.auxdata) < 0) {
break;
Reported by FlawFinder.