The following issues were found
Modules/_functoolsmodule.c
2 issues
Line: 256
Column: 5
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
}
/* Copy to new stack, using borrowed references */
memcpy(stack, pto_args, pto_nargs * sizeof(PyObject*));
memcpy(stack + pto_nargs, args, nargs_total * sizeof(PyObject*));
ret = _PyObject_VectorcallTstate(tstate, pto->fn,
stack, pto_nargs + nargs, kwnames);
if (stack != small_stack) {
Reported by FlawFinder.
Line: 257
Column: 5
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
/* Copy to new stack, using borrowed references */
memcpy(stack, pto_args, pto_nargs * sizeof(PyObject*));
memcpy(stack + pto_nargs, args, nargs_total * sizeof(PyObject*));
ret = _PyObject_VectorcallTstate(tstate, pto->fn,
stack, pto_nargs + nargs, kwnames);
if (stack != small_stack) {
PyMem_Free(stack);
Reported by FlawFinder.
Lib/unittest/test/__main__.py
2 issues
Line: 1
Column: 1
import os
import unittest
def load_tests(loader, standard_tests, pattern):
# top level directory cached on loader instance
this_dir = os.path.dirname(__file__)
pattern = pattern or "test_*.py"
# We are inside unittest.test, so the top-level is two notches up
Reported by Pylint.
Line: 5
Column: 1
import unittest
def load_tests(loader, standard_tests, pattern):
# top level directory cached on loader instance
this_dir = os.path.dirname(__file__)
pattern = pattern or "test_*.py"
# We are inside unittest.test, so the top-level is two notches up
top_level_dir = os.path.dirname(os.path.dirname(this_dir))
Reported by Pylint.
Lib/unittest/test/testmock/__main__.py
2 issues
Line: 1
Column: 1
import os
import unittest
def load_tests(loader, standard_tests, pattern):
# top level directory cached on loader instance
this_dir = os.path.dirname(__file__)
pattern = pattern or "test*.py"
# We are inside unittest.test.testmock, so the top-level is three notches up
Reported by Pylint.
Line: 5
Column: 1
import unittest
def load_tests(loader, standard_tests, pattern):
# top level directory cached on loader instance
this_dir = os.path.dirname(__file__)
pattern = pattern or "test*.py"
# We are inside unittest.test.testmock, so the top-level is three notches up
top_level_dir = os.path.dirname(os.path.dirname(os.path.dirname(this_dir)))
Reported by Pylint.
Modules/_decimal/libmpdec/mpalloc.c
2 issues
Line: 227
Column: 5
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
return 0;
}
memcpy(result->data, p, result->alloc * (sizeof *result->data));
result->alloc = nwords;
mpd_set_dynamic_data(result);
return 1;
}
Reported by FlawFinder.
Line: 313
Column: 5
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
return 0;
}
memcpy(data, result->data, result->alloc * (sizeof *result->data));
result->data = data;
result->alloc = nwords;
mpd_set_dynamic_data(result);
return 1;
}
Reported by FlawFinder.
Tools/demo/rpython.py
2 issues
Line: 14
Column: 1
PORT = 4127
BUFSIZE = 1024
def main():
if len(sys.argv) < 3:
print("usage: rpython host command")
sys.exit(2)
host = sys.argv[1]
port = PORT
Reported by Pylint.
Line: 25
Column: 42
port = int(host[i+1:])
host = host[:i]
command = ' '.join(sys.argv[2:])
with socket(AF_INET, SOCK_STREAM) as s:
s.connect((host, port))
s.send(command.encode())
s.shutdown(SHUT_WR)
reply = b''
while True:
Reported by Pylint.
Lib/test/test_tools/__main__.py
2 issues
Line: 1
Column: 1
from test.test_tools import load_tests
import unittest
unittest.main()
Reported by Pylint.
Line: 1
Column: 1
from test.test_tools import load_tests
import unittest
unittest.main()
Reported by Pylint.
Tools/freeze/flag.py
2 issues
Line: 1
Column: 1
initialized = True
print("Hello world!")
Reported by Pylint.
Line: 1
Column: 1
initialized = True
print("Hello world!")
Reported by Pylint.
Modules/_decimal/libmpdec/constants.c
2 issues
Line: 115
Column: 7
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
#error "CONFIG_64 or CONFIG_32 must be defined."
#endif
const char * const mpd_round_string[MPD_ROUND_GUARD] = {
"ROUND_UP", /* round away from 0 */
"ROUND_DOWN", /* round toward 0 (truncate) */
"ROUND_CEILING", /* round toward +infinity */
"ROUND_FLOOR", /* round toward -infinity */
"ROUND_HALF_UP", /* 0.5 is rounded up */
Reported by FlawFinder.
Line: 127
Column: 7
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
"ROUND_TRUNC", /* truncate, but set infinity */
};
const char * const mpd_clamp_string[MPD_CLAMP_GUARD] = {
"CLAMP_DEFAULT",
"CLAMP_IEEE_754"
};
Reported by FlawFinder.
Modules/_ctypes/libffi_osx/x86/x86-ffi_darwin.c
2 issues
Line: 107
Column: 13
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
}
else
{
memcpy(argp, *p_argv, z);
}
p_argv++;
argp += z;
}
Reported by FlawFinder.
Line: 380
Column: 5
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
static void
ffi_prep_args_raw(char *stack, extended_cif *ecif)
{
memcpy (stack, ecif->avalue, ecif->cif->bytes);
}
/* we borrow this routine from libffi (it must be changed, though, to
* actually call the function passed in the first argument. as of
* libffi-1.20, this is not the case.)
Reported by FlawFinder.
Modules/sre_lib.h
2 issues
Line: 445
Column: 5
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
if (ctx_pos != -1) \
DATA_STACK_LOOKUP_AT(state, SRE(match_context), ctx, ctx_pos); \
} \
memcpy(state->data_stack+state->data_stack_base, data, size); \
state->data_stack_base += size; \
} while (0)
/* We add an explicit cast to memcpy here because MSVC has a bug when
compiling C code where it believes that `const void**` cannot be
Reported by FlawFinder.
Line: 456
Column: 5
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
do { \
TRACE(("copy data to %p from %zd (%zd)\n", \
data, state->data_stack_base-size, size)); \
memcpy((void*) data, state->data_stack+state->data_stack_base-size, size); \
if (discard) \
state->data_stack_base -= size; \
} while (0)
#define DATA_STACK_POP_DISCARD(state, size) \
Reported by FlawFinder.