The following issues were found
Tools/freeze/test/ok.py
1 issues
Line: 1
Column: 1
import sys
sys.exit(0)
Reported by Pylint.
Modules/clinic/symtablemodule.c.h
1 issues
Line: 42
Column: 9
CWE codes:
126
if (startstr == NULL) {
goto exit;
}
if (strlen(startstr) != (size_t)startstr_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
return_value = _symtable_symtable_impl(module, source, filename, startstr);
Reported by FlawFinder.
Modules/_zoneinfo.c
1 issues
Line: 2072
Column: 9
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
return -1;
}
memcpy(trans_local[i], trans_utc, num_transitions * sizeof(int64_t));
}
int64_t offset_0, offset_1, buff;
if (num_ttinfos > 1) {
offset_0 = utcoff[0];
Reported by FlawFinder.
Python/getversion.c
1 issues
Line: 11
Column: 12
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
const char *
Py_GetVersion(void)
{
static char version[250];
PyOS_snprintf(version, sizeof(version), "%.80s (%.80s) %.80s",
PY_VERSION, Py_GetBuildInfo(), Py_GetCompiler());
return version;
}
Reported by FlawFinder.
Objects/complexobject.c
1 issues
Line: 588
Column: 9
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 *res;
Py_complex i;
int equal;
if (op != Py_EQ && op != Py_NE) {
goto Unimplemented;
}
Reported by FlawFinder.
Python/frame.c
1 issues
Line: 58
Column: 5
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
return NULL;
}
PyObject **locals = _PyFrame_GetLocalsArray(frame);
memcpy(copy, locals, size);
InterpreterFrame *res = (InterpreterFrame *)(copy + frame->nlocalsplus);
return res;
}
static inline void
Reported by FlawFinder.
Python/errors.c
1 issues
Line: 1695
Column: 5
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
err_programtext(PyThreadState *tstate, FILE *fp, int lineno)
{
int i;
char linebuf[1000];
if (fp == NULL) {
return NULL;
}
for (i = 0; i < lineno; i++) {
Reported by FlawFinder.
Python/dtoa.c
1 issues
Line: 444
Column: 20
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
#endif /* Py_USING_MEMORY_DEBUGGER */
#define Bcopy(x,y) memcpy((char *)&x->sign, (char *)&y->sign, \
y->wds*sizeof(Long) + 2*sizeof(int))
/* Multiply a Bigint b by m and add a. Either modifies b in place and returns
a pointer to the modified b, or Bfrees b and returns a pointer to a copy.
On failure, return NULL. In this case, b will have been already freed. */
Reported by FlawFinder.
Modules/_multiprocessing/clinic/semaphore.c.h
1 issues
Line: 197
Column: 9
CWE codes:
126
if (name == NULL) {
goto exit;
}
if (strlen(name) != (size_t)name_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
unlink = _PyLong_AsInt(fastargs[4]);
if (unlink == -1 && PyErr_Occurred()) {
Reported by FlawFinder.
Python/condvar.h
1 issues
Line: 111
Column: 5
CWE codes:
Suggestion:
Use InitializeCriticalSectionAndSpinCount instead
Py_LOCAL_INLINE(int)
PyMUTEX_INIT(PyMUTEX_T *cs)
{
InitializeCriticalSection(cs);
return 0;
}
Py_LOCAL_INLINE(int)
PyMUTEX_FINI(PyMUTEX_T *cs)
Reported by FlawFinder.