text
stringlengths
79
3.72M
<vulnerable_code> /* Add a custom type */ temp = PyType_FromSpec(&Example_Type_spec); if (temp == NULL) { goto fail; } if (PyModule_AddObject(m, "Example", temp) != 0) { Py_DECREF(temp); goto fail; } /* Add an exception type */ temp = PyErr_NewException("_testim...
<vulnerable_code>PyMODINIT_FUNC PyInit__tkinter(void) { PyObject *m, *uexe, *cexe, *o; tcl_lock = PyThread_allocate_lock(); if (tcl_lock == NULL) if (m == NULL) return NULL; o = PyErr_NewException("_tkinter.TclError", NULL, NULL); if (o == NULL) { Py_DECREF(m); return NUL...
<vulnerable_code>static int weakref_exec(PyObject *module) { Py_INCREF(&_PyWeakref_RefType); if (PyModule_AddObject(module, "ref", (PyObject *) &_PyWeakref_RefType) < 0) { Py_DECREF(&_PyWeakref_RefType); return -1; } Py_INCREF(&_PyWeakref_RefType); if (PyModule_AddObject(module, "Ref...
<vulnerable_code> CREATE_TYPE(m, state->ArrayIterType, &arrayiter_spec); Py_SET_TYPE(state->ArrayIterType, &PyType_Type); if (PyModule_AddObject(m, "ArrayType", Py_NewRef((PyObject *)state->ArrayType)) < 0) { Py_DECREF((PyObject *)state->ArrayType); return -1; ...
<vulnerable_code>PyDoc_STRVAR(doc_binascii, "Conversion between binary data and ASCII"); static int binascii_exec(PyObject *module) { int result; binascii_state *state = PyModule_GetState(module); if (state == NULL) { return -1; } state->Error = PyErr_NewException("binascii.Error", PyExc_V...
<vulnerable_code> st->md5_type = (PyTypeObject *)PyType_FromModuleAndSpec( m, &md5_type_spec, NULL); if (st->md5_type == NULL) { return -1; } Py_INCREF((PyObject *)st->md5_type); if (PyModule_AddObject(m, "MD5Type", (PyObject *)st->md5_type) < 0) { Py_DECREF(st->md5_type); ...
<vulnerable_code>static int mmap_exec(PyObject *module) { Py_INCREF(PyExc_OSError); if (PyModule_AddObject(module, "error", PyExc_OSError) < 0) { Py_DECREF(PyExc_OSError); return -1; } <commit_title>[PATCH 016/395] Small fixes to code generator (#106845)<commit_description>These repair nits ...
<vulnerable_code> #define WINAPI_CONSTANT(fmt, con) \ do { \ PyObject *value = Py_BuildValue(fmt, con); \ if (value == NULL) { \ return -1; \ } \ if (PyModule_AddObject(module, #con, value) < 0 ) { \ Py_DECREF(value); \ return -1; \ } \ ...
<vulnerable_code> Py_DECREF(mod_name); /* gives away the reference to the submodule */ if (PyModule_AddObject(mod, name, submodule) < 0) { Py_DECREF(submodule); return NULL; } goto error; } } if (PyModule_AddObject(mod, "features", list) < 0) { goto e...
<vulnerable_code> } while (0) /* Add some symbolic constants to the module */ Py_INCREF(PyExc_OSError); if (PyModule_AddObject(module, "error", PyExc_OSError) < 0) { Py_DECREF(PyExc_OSError); return -1; } { v = PyLong_FromLong((long) RLIM_INFINITY); } if (!v) { ...
<vulnerable_code> st->sha1_type = (PyTypeObject *)PyType_FromModuleAndSpec( module, &sha1_type_spec, NULL); if (st->sha1_type == NULL) { return -1; } Py_INCREF(st->sha1_type); if (PyModule_AddObject(module, "SHA1Type", (PyObject...
<vulnerable_code> struct constant *constant = termios_constants; termiosmodulestate *state = get_termios_state(mod); state->TermiosError = PyErr_NewException("termios.error", NULL, NULL); if (state->TermiosError == NULL) { return -1; } Py_INCREF(state->TermiosError); if (PyModule_AddO...
<vulnerable_code> v = new_previous_version(ucd_type, "3.2.0", get_change_3_2_0, normalization_3_2_0); Py_DECREF(ucd_type); if (v == NULL) { return -1; } if (PyModule_AddObject(module, "ucd_3_2_0", v) < 0) { Py_DECREF(v); return -1; } <commit_ti...
<vulnerable_code> } state->ZlibError = PyErr_NewException("zlib.error", NULL, NULL); if (state->ZlibError == NULL) { return -1; } if (PyModule_AddObject(mod, "error", Py_NewRef(state->ZlibError)) < 0) { Py_DECREF(state->ZlibError); return -1; } if (PyModule_AddObject...
<vulnerable_code> # The log message sent to the SysLogHandler is properly received. logger = logging.getLogger("slh") logger.error("sp\xe4m") self.handled.wait() self.assertEqual(self.log_output, b'<11>sp\xc3\xa4m\x00') self.handled.clear() self.sl_hdlr.append_nul ...
<vulnerable_code>#include "pycore_pylifecycle.h" // _Py_IsInterpreterFinalizing() #include "pycore_pystate.h" // _PyThreadState_GET() #include "pycore_runtime_init.h" // _Py_ID() #include "structmember.h" // PyMemberDef #include <stddef.h> // offsetof() <commit_title>[PATCH 016/395] Smal...
<vulnerable_code>/* _bz2 - Low-level Python interface to libbzip2. */ #include "Python.h" #include "structmember.h" // PyMemberDef #include <bzlib.h> #include <stdio.h> // Blocks output buffer wrappers #include "pycore_blocks_output_buffer.h" typedef struct { PyObject_HEAD bz_stream bzs; char eof...
<vulnerable_code>#include "pycore_long.h" // _PyLong_GetZero() #include "pycore_moduleobject.h" // _PyModule_GetState() #include "pycore_typeobject.h" // _PyType_GetModuleState() #include "structmember.h" // PyMemberDef #include <stddef.h> typedef struct { }; static PyMemberDef deque_members[] = ...
<vulnerable_code>#define MODULE_VERSION "1.0" #include "Python.h" #include "structmember.h" // PyMemberDef #include <stdbool.h> /*[clinic input] #define D_OFF(x) offsetof(DialectObj, x) static struct PyMemberDef Dialect_memberlist[] = { { "skipinitialspace", T_BOOL, D_OFF(skipinitialspace), READONLY },...
<vulnerable_code> #include "pycore_call.h" // _PyObject_CallNoArgs() #include "pycore_ceval.h" // _Py_EnterRecursiveCall() #include "structmember.h" // PyMemberDef #include <ffi.h> #ifdef MS_WIN32 } static PyMemberDef PyCData_members[] = { { "_b_base_", T_OBJECT, offsetof(CDataObjec...
<vulnerable_code>#endif #include "Python.h" #include "structmember.h" // PyMemberDef #include <stdbool.h> } static PyMemberDef PyCArgType_members[] = { { "_obj", T_OBJECT, offsetof(PyCArgObject, obj), READONLY, "the wrapped object" }, { NULL }, };<commit_title>[PATCH 016/395] Small fixes...
<vulnerable_code>#include "pycore_long.h" // _PyLong_GetOne() #include "pycore_object.h" // _PyObject_Init() #include "datetime.h" #include "structmember.h" // PyMemberDef #include <time.h> static PyMemberDef delta_members[] = { {"days", T_INT, OFFSET(days), READONLY, ...
<vulnerable_code>#include "Python.h" #include "pycore_import.h" // _PyImport_GetModuleAttrString() #include "pycore_pyhash.h" // _Py_HashSecret #include "structmember.h" // PyMemberDef #include "expat.h" #include "pyexpat.h" } static PyMemberDef xmlparser_members[] = { {"entity", T_OBJECT, o...
<vulnerable_code>#include "pycore_object.h" // _PyObject_GC_TRACK #include "pycore_pystate.h" // _PyThreadState_GET() #include "pycore_tuple.h" // _PyTuple_ITEMS() #include "structmember.h" // PyMemberDef #include "clinic/_functoolsmodule.c.h" /*[clinic input] #define OFF(x) offsetof(part...
<vulnerable_code>#include "pycore_object.h" // _PyObject_GC_UNTRACK() #include "pycore_pyerrors.h" // _Py_FatalErrorFormat() #include "pycore_pylifecycle.h" // _Py_IsInterpreterFinalizing() #include "structmember.h" // PyMemberDef #include "_iomodule.h" /*[clinic input] }; static PyMemberDef buf...
<vulnerable_code>}; static PyMemberDef bytesio_members[] = { {"__weaklistoffset__", T_PYSSIZET, offsetof(bytesio, weakreflist), READONLY}, {"__dictoffset__", T_PYSSIZET, offsetof(bytesio, dict), READONLY}, {NULL} }; <commit_title>[PATCH 016/395] Small fixes to code generator (#106845)<commit_description>Th...
<vulnerable_code>#include "Python.h" #include "pycore_fileutils.h" // _Py_BEGIN_SUPPRESS_IPH #include "pycore_object.h" // _PyObject_GC_UNTRACK() #include "structmember.h" // PyMemberDef #include <stdbool.h> #ifdef HAVE_SYS_TYPES_H #include <sys/types.h> }; static PyMemberDef fileio_members[] = { ...
<vulnerable_code>}; static struct PyMemberDef iobase_members[] = { {"__weaklistoffset__", T_PYSSIZET, offsetof(iobase, weakreflist), READONLY}, {"__dictoffset__", T_PYSSIZET, offsetof(iobase, dict), READONLY}, {NULL}, }; <commit_title>[PATCH 016/395] Small fixes to code generator (#106845)<commit_descripti...
<vulnerable_code>}; static struct PyMemberDef stringio_members[] = { {"__weaklistoffset__", T_PYSSIZET, offsetof(stringio, weakreflist), READONLY}, {"__dictoffset__", T_PYSSIZET, offsetof(stringio, dict), READONLY}, {NULL}, }; <commit_title>[PATCH 016/395] Small fixes to code generator (#106845)<commit_des...
<vulnerable_code>#include "pycore_fileutils.h" // _Py_GetLocaleEncoding() #include "pycore_object.h" // _PyObject_GC_UNTRACK() #include "pycore_pystate.h" // _PyInterpreterState_GET() #include "structmember.h" // PyMemberDef #include "_iomodule.h" /*[clinic input] }; static PyMemberDef textio...
<vulnerable_code> #ifdef HAVE_WINDOWS_CONSOLE_IO #include "structmember.h" // PyMemberDef #ifdef HAVE_SYS_TYPES_H #include <sys/types.h> #endif }; static PyMemberDef winconsoleio_members[] = { {"_blksize", T_UINT, offsetof(winconsoleio, blksize), 0}, {"_finalizing", T_BOOL, offsetof(winconsoleio, fina...
<vulnerable_code>#include "Python.h" #include "pycore_ceval.h" // _Py_EnterRecursiveCall() #include "pycore_runtime.h" // _PyRuntime #include "structmember.h" // PyMemberDef #include "pycore_global_objects.h" // _Py_ID() #include <stdbool.h> // bool } PyScannerObject; stati...
<vulnerable_code>*/ #include "Python.h" #include "structmember.h" // PyMemberDef #include <stdlib.h> // free() #include <string.h> "Data found after the end of the compressed stream."); static PyMemberDef Decompressor_members[] = { {"check", T_INT, offsetof(Decompressor, check), READONLY, ...
<vulnerable_code> */ static PyMemberDef semlock_members[] = { {"handle", T_SEM_HANDLE, offsetof(SemLockObject, handle), READONLY, ""}, {"kind", T_INT, offsetof(SemLockObject, kind), READONLY, ""}, {"maxvalue", T_INT, offsetof(SemLockObject, maxvalue), READONLY, ""}, {"name", T_STRING, of...
<vulnerable_code>#include "pycore_moduleobject.h" // _PyModule_GetState() #include "pycore_runtime.h" // _Py_ID() #include "structmember.h" // PyMemberDef #include "clinic/_operator.c.h" typedef struct { }; static PyMemberDef itemgetter_members[] = { {"__vectorcalloffset__", T_PYSSIZET, offsetof(i...
<vulnerable_code>#include "pycore_pystate.h" // _PyThreadState_GET() #include "pycore_runtime.h" // _Py_ID() #include "pycore_setobject.h" // _PySet_NextEntry() #include "structmember.h" // PyMemberDef #include <stdlib.h> // strtol() } static PyMemberDef Pickler_members[] = { ...
<vulnerable_code>#include "Python.h" #include "pycore_moduleobject.h" // _PyModule_GetState() #include "pycore_time.h" // _PyTime_t #include "structmember.h" // PyMemberDef #include <stddef.h> // offsetof() typedef struct { }; static struct PyMemberDef simplequeue_members[] = { {"_...
<vulnerable_code>}; static struct PyMemberDef blob_members[] = { {"__weaklistoffset__", T_PYSSIZET, offsetof(pysqlite_Blob, in_weakreflist), READONLY}, {NULL}, }; <commit_title>[PATCH 016/395] Small fixes to code generator (#106845)<commit_description>These repair nits I found in PR gh-106798 (issue gh-106797)...
<vulnerable_code>#endif #include "module.h" #include "structmember.h" // PyMemberDef #include "connection.h" #include "statement.h" #include "cursor.h" static struct PyMemberDef connection_members[] = { {"Warning", T_OBJECT, offsetof(pysqlite_Connection, Warning), READONLY}, {"Error", T_OBJECT, offset...
<vulnerable_code> static struct PyMemberDef cursor_members[] = { {"connection", T_OBJECT, offsetof(pysqlite_Cursor, connection), READONLY}, {"description", T_OBJECT, offsetof(pysqlite_Cursor, description), READONLY}, {"arraysize", T_INT, offsetof(pysqlite_Cursor, arraysize), 0}, {"lastrowid", T_OBJECT, ...
<vulnerable_code>#include "Python.h" #include "pycore_long.h" // _PyLong_GetZero() #include "pycore_moduleobject.h" // _PyModule_GetState() #include "structmember.h" // PyMemberDef #include "sre.h" #define PAT_OFF(x) offsetof(PatternObject, x) static PyMemberDef pattern_members[] = { {"pattern"...
<vulnerable_code>#include "Python.h" #include "pycore_bytesobject.h" // _PyBytesWriter #include "pycore_moduleobject.h" // _PyModule_GetState() #include "structmember.h" // PyMemberDef #include <ctype.h> /*[clinic input] class Struct "PyStructObject *" "&PyStructType" }; static PyMemberDef s_members[] = { ...
<vulnerable_code> #include "parts.h" #include "structmember.h" // PyMemberDef #include <stddef.h> // offsetof typedef struct { }; static struct PyMemberDef testbuf_members[] = { {"references", T_PYSSIZET, offsetof(testBufObject, references), READONLY}, {NULL}, }; <commit_title>[PATC...
<vulnerable_code>#include "parts.h" #include "structmember.h" // PyMemberDef static struct PyModuleDef *_testcapimodule = NULL; // set at initialization static struct PyMemberDef members_to_repeat[] = { {"T_INT", T_INT, offsetof(HeapCTypeWithDataObject, data), 0, NULL}, {NULL} }; } HeapCTypeObject...
<vulnerable_code>#include "parts.h" #include "clinic/vectorcall.c.h" #include "structmember.h" // PyMemberDef #include <stddef.h> // offsetof /*[clinic input] }; PyMemberDef VectorCallClass_members[] = { {"__vectorcalloffset__", T_PYSSIZET, 0/* set later */, READONLY}, {NULL} }; <co...
<vulnerable_code> #ifdef LIMITED_API_AVAILABLE #include "structmember.h" // PyMemberDef /* Test Vectorcall in the limited API */ } static PyMemberDef LimitedVectorCallClass_members[] = { {"__vectorcalloffset__", T_PYSSIZET, sizeof(PyObject), READONLY}, {NULL} }; <commit_title>[PATCH 016/395] Small f...
<vulnerable_code>#include "Python.h" #include "frameobject.h" // PyFrame_New #include "marshal.h" // PyMarshal_WriteLongToFile #include "structmember.h" // for offsetof(), T_OBJECT #include <float.h> // FLT_MAX #include <signal.h> #ifndef MS_WINDOWS #include <unistd.h> #endi...
<vulnerable_code>#include "pycore_pystate.h" // _PyThreadState_SetCurrent() #include "pycore_weakref.h" // _PyWeakref_GET_REF() #include <stddef.h> // offsetof() #include "structmember.h" // PyMemberDef #ifdef HAVE_SIGNAL_H # include <signal.h> // SIGINT will block until ...
<vulnerable_code>#include "pycore_moduleobject.h" // _PyModule_GetState() #include "pycore_pylifecycle.h" // _Py_IsInterpreterFinalizing() #include "pycore_pystate.h" // _PyInterpreterState_GET #include "structmember.h" // PyMemberDef #ifndef WINDOWS_LEAN_AND_MEAN PyLong_FromUnsignedLong((unsigne...
<vulnerable_code> #include "Python.h" #include "pycore_long.h" // _PyLong_GetOne() #include "structmember.h" #include <ctype.h> #include <stddef.h> static PyMemberDef zoneinfo_members[] = { {.name = "key", .offset = offsetof(PyZoneInfo_ZoneInfo, key), .type = T_OBJECT_EX, .flags = READONLY,...
<vulnerable_code>#include "pycore_call.h" // _PyObject_CallMethod() #include "pycore_moduleobject.h" // _PyModule_GetState() #include "pycore_bytesobject.h" // _PyBytes_Repeat #include "structmember.h" // PyMemberDef #include <stddef.h> // offsetof() #include <stdbool.h> static PyObje...
<vulnerable_code>#endif #include "Python.h" #include "structmember.h" // PyMemberDef #include "multibytecodec.h" #include "clinic/multibytecodec.c.h" #define MODULE_NAME "_multibytecodec" typedef struct { }; static PyMemberDef mbstreamreader_members[] = { {"stream", T_OBJECT, ...
<vulnerable_code>#include "pycore_typeobject.h" // _PyType_GetModuleState() #include "pycore_object.h" // _PyObject_GC_TRACK() #include "pycore_tuple.h" // _PyTuple_ITEMS() #include "structmember.h" // PyMemberDef #include <stddef.h> // offsetof() /* Itertools module written and...
<vulnerable_code>#include <Python.h> #include "pycore_bytesobject.h" // _PyBytes_Find() #include "pycore_fileutils.h" // _Py_stat_struct #include "structmember.h" // PyMemberDef #include <stddef.h> // offsetof() // to support MS_WINDOWS_SYSTEM OpenFileMappingA / CreateFileMappingA #endif //...
<vulnerable_code> Check itemsize */ #include "Python.h" #include "structmember.h" // PyMemberDef #define WINDOWS_LEAN_AND_MEAN #include <winsock2.h> #if defined(MS_WIN32) && !defined(MS_WIN64) # define F_POINTER "k" # define T_POINTER T_ULONG #else # define F_POINTER "K" # define T_POINTER T_ULONGLONG ...
<vulnerable_code># endif /* MS_WINDOWS_DESKTOP | MS_WINDOWS_SYSTEM */ #endif #include "structmember.h" // PyMemberDef #ifndef MS_WINDOWS # include "posixmodule.h" #else } static PyMemberDef DirEntry_members[] = { {"name", T_OBJECT_EX, offsetof(DirEntry, name), READONLY, "the entry's base filename, ...
<vulnerable_code>#include "Python.h" #include "pycore_import.h" // _PyImport_SetModule() #include "pycore_pyhash.h" // _Py_HashSecret #include <ctype.h> #include "structmember.h" // PyMemberDef #include "expat.h" #include "pyexpat.h" /* Do not emit Clinic output to a file as that wreaks havoc w...
<vulnerable_code>#include "Python.h" #include "pycore_fileutils.h" // _Py_set_inheritable() #include "pycore_time.h" // _PyTime_t #include "structmember.h" // PyMemberDef #ifdef HAVE_SYS_DEVPOLL_H #include <sys/resource.h> #if (SIZEOF_UINTPTR_T != SIZEOF_VOID_P) # error uintptr_t does not match ...
<vulnerable_code>#include "pycore_moduleobject.h" // _PyModule_GetState() #include "pycore_typeobject.h" // _PyType_GetModuleState() #include "pycore_strhex.h" // _Py_strhex() #include "structmember.h" // PyMemberDef #include "hashlib.h" /*[clinic input]<commit_title>[PATCH 016/395] Small fixes to c...
<vulnerable_code>#include "Python.h" #include "pycore_fileutils.h" // _Py_set_inheritable() #include "pycore_moduleobject.h" // _PyModule_GetState #include "structmember.h" // PyMemberDef #ifdef _Py_MEMORY_SANITIZER # include <sanitizer/msan_interface.h> /* SockObject members */ static PyMemberDef sock_m...
<vulnerable_code> #include "Python.h" #include "pycore_ucnhash.h" // _PyUnicode_Name_CAPI #include "structmember.h" // PyMemberDef #include <stdbool.h> /*[clinic input] module unicodedata #define get_old_record(self, v) ((((PreviousDBVersion*)self)->getrecord)(v)) static PyMemberDef DB_members[] = {...
<vulnerable_code>#include "Python.h" #include "structmember.h" // PyMemberDef PyDoc_STRVAR(xxsubtype__doc__, "xxsubtype is an example module showing how to subtype builtin types from C.\n" } static PyMemberDef spamdict_members[] = { {"state", T_INT, offsetof(spamdictobject, state), READONLY, PyDoc_ST...
<vulnerable_code>/* Windows users: read Python's PCbuild\readme.txt */ #include "Python.h" #include "structmember.h" // PyMemberDef #include "zlib.h" #include "stdbool.h" decompress_buf() */ Py_ssize_t avail_in_real; bool is_initialised; char eof; /* T_BOOL expects a char */ ...
<vulnerable_code>#include "pycore_object.h" #include "pycore_pyerrors.h" #include "pycore_pystate.h" // _PyThreadState_GET() #include "structmember.h" // PyMemberDef #include "clinic/classobject.c.h" #define MO_OFF(x) offsetof(PyMethodObject, x) static PyMemberDef method_memberlist[] = { {"__func__...
<vulnerable_code> #include "Python.h" #include "opcode.h" #include "structmember.h" // PyMemberDef #include "pycore_code.h" // _PyCodeConstructor #include "pycore_frame.h" // FRAME_SPECIALS_SIZE #include "pycore_interp.h" // PyInterpreterState.co_extra_freefuncs #define OFF(x) offsetof(P...
<vulnerable_code>#include "pycore_long.h" // _PyLong_GetZero() #include "pycore_object.h" // _PyObject_Init() #include "pycore_pymath.h" // _Py_ADJUST_ERANGE2() #include "structmember.h" // PyMemberDef /*[clinic input] }; static PyMemberDef complex_members[] = { {"real", T_DOUBLE, ...
<vulnerable_code>#include "pycore_object.h" // _PyObject_GC_UNTRACK() #include "pycore_pystate.h" // _PyThreadState_GET() #include "pycore_tuple.h" // _PyTuple_ITEMS() #include "structmember.h" // PyMemberDef /*[clinic input] class mappingproxy "mappingproxyobject *" "&PyDictProxy_Type" ...
<vulnerable_code>#include "pycore_exceptions.h" // struct _Py_exc_state #include "pycore_initconfig.h" #include "pycore_object.h" #include "structmember.h" // PyMemberDef #include "osdefs.h" // SEP } static struct PyMemberDef BaseException_members[] = { {"__suppress_context__", T_BOOL, ...
<vulnerable_code>#include "frameobject.h" // PyFrameObject #include "pycore_frame.h" #include "opcode.h" // EXTENDED_ARG #include "structmember.h" // PyMemberDef #define OFF(x) offsetof(PyFrameObject, x) static PyMemberDef frame_memberlist[] = { {"f_trace_lines", T_BOOL, O...
<vulnerable_code>#include "pycore_code.h" // _Py_next_func_version #include "pycore_object.h" // _PyObject_GC_UNTRACK() #include "pycore_pyerrors.h" // _PyErr_Occurred() #include "structmember.h" // PyMemberDef static PyObject* func_repr(PyFunctionObject *op); #define OFF(x) offsetof(PyFu...
<vulnerable_code>#include "Python.h" #include "pycore_object.h" #include "pycore_unionobject.h" // _Py_union_type_or, _PyGenericAlias_Check #include "structmember.h" // PyMemberDef #include <stdbool.h> }; static PyMemberDef ga_members[] = { {"__origin__", T_OBJECT, offsetof(gaobject, origin), READONLY}...
<vulnerable_code>#include "pycore_object.h" // _PyObject_GC_UNTRACK() #include "pycore_pyerrors.h" // _PyErr_ClearExcState() #include "pycore_pystate.h" // _PyThreadState_GET() #include "structmember.h" // PyMemberDef #include "opcode.h" // SEND #include "frameobject.h" ...
<vulnerable_code>#include "pycore_object.h" #include "pycore_pyerrors.h" #include "pycore_pystate.h" // _PyThreadState_GET() #include "structmember.h" // PyMemberDef /* undefine macro trampoline to PyCFunction_NewEx */ #undef PyCFunction_New #define OFF(x) offsetof(PyCFunctionObject, x) static PyMemberD...
<vulnerable_code>#include "pycore_object.h" // _PyType_AllocNoTrack #include "pycore_pyerrors.h" // _PyErr_FormatFromCause() #include "pycore_pystate.h" // _PyInterpreterState_GET() #include "structmember.h" // PyMemberDef static PyMemberDef module_members[] = { {"__dict__", T_OBJECT, of...
<vulnerable_code> #include "Python.h" #include "pycore_namespace.h" // _PyNamespace_Type #include "structmember.h" // PyMemberDef typedef struct { static PyMemberDef namespace_members[] = { {"__dict__", T_OBJECT, offsetof(_PyNamespaceObject, ns_dict), READONLY}, {NULL} }; <commit_title>[PATCH 01...
<vulnerable_code>#include "pycore_modsupport.h" // _PyArg_NoKwnames() #include "pycore_range.h" #include "pycore_tuple.h" // _PyTuple_ITEMS() #include "structmember.h" // PyMemberDef /* Support objects whose length is > PY_SSIZE_T_MAX. }; static PyMemberDef range_members[] = { {"start", T_OB...
<vulnerable_code>#include "pycore_abstract.h" // _PyIndex_Check() #include "pycore_long.h" // _PyLong_GetZero() #include "pycore_object.h" // _PyObject_GC_TRACK() #include "structmember.h" // PyMemberDef static PyObject * ellipsis_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) }...
<vulnerable_code>#include "Python.h" #include "pycore_tuple.h" // _PyTuple_FromArray() #include "pycore_object.h" // _PyObject_GC_TRACK() #include "structmember.h" // PyMemberDef #include "pycore_structseq.h" // PyStructSequence_InitType() #include "pycore_initconfig.h" // _PyStatus_OK() ...
<vulnerable_code>#include "pycore_unionobject.h" // _Py_union_type_or #include "pycore_weakref.h" // _PyWeakref_GET_REF() #include "opcode.h" // MAKE_CELL #include "structmember.h" // PyMemberDef #include <ctype.h> #include <stddef.h> // ptrdiff_t static PyMemberDef type_m...
<vulnerable_code>#include "pycore_object.h" // _PyObject_GC_TRACK/UNTRACK #include "pycore_typevarobject.h" #include "pycore_unionobject.h" // _Py_union_type_or #include "structmember.h" /*[clinic input] class typevar "typevarobject *" "&_PyTypeVar_Type" } static PyMemberDef typevar_members[] = { {"__nam...
<vulnerable_code>#include "pycore_object.h" // _PyObject_GC_TRACK/UNTRACK #include "pycore_typevarobject.h" // _PyTypeAlias_Type #include "pycore_unionobject.h" #include "structmember.h" static PyObject *make_union(PyObject *); } static PyMemberDef union_members[] = { {"__args__", T_OBJECT, offsetof(uniono...
<vulnerable_code>#include "pycore_modsupport.h" // _PyArg_NoKwnames() #include "pycore_object.h" // _PyObject_GET_WEAKREFS_LISTPTR() #include "pycore_weakref.h" // _PyWeakref_GET_REF() #include "structmember.h" // PyMemberDef #define GET_WEAKREFS_LISTPTR(o) \ static PyMemberDef weakref_membe...
<vulnerable_code>#include "Python.h" #include "pycore_object.h" // _PyObject_Init() #include "pycore_moduleobject.h" #include "structmember.h" // PyMemberDef #include <windows.h> #if defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES) #define OFF(e) offsetof(PyHKEYObj...
<vulnerable_code>} static PyMemberDef ast_type_members[] = { {"__dictoffset__", T_PYSSIZET, offsetof(AST_object, dict), READONLY}, {NULL} /* Sentinel */ }; #include "pycore_ceval.h" // _Py_EnterRecursiveCall #include "pycore_interp.h" // _PyInterpreterState.ast #include...
<vulnerable_code>#include "optimizer.h" #include "pydtrace.h" #include "setobject.h" #include "structmember.h" // struct PyMemberDef, T_OFFSET_EX #define USE_COMPUTED_GOTOS 0 #include "ceval_macros.h"<commit_title>[PATCH 016/395] Small fixes to code generator (#106845)<commit_description>These repair nits I fo...
<vulnerable_code>#include "opcode.h" #include "pydtrace.h" #include "setobject.h" #include "structmember.h" // struct PyMemberDef, T_OFFSET_EX #include <ctype.h> #include <stdbool.h><commit_title>[PATCH 016/395] Small fixes to code generator (#106845)<commit_description>These repair nits I found in PR gh-10679...
<vulnerable_code>#include "pycore_object.h" #include "pycore_pyerrors.h" #include "pycore_pystate.h" // _PyThreadState_GET() #include "structmember.h" // PyMemberDef #include "clinic/context.c.h" static PyMemberDef PyContextVar_members[] = { {"name", T_OBJECT, offsetof(PyContextVar, var_name), REA...
<vulnerable_code>#include "pycore_object.h" #include "pycore_opcode.h" // _PyOpcode_Caches #include "pycore_pylifecycle.h" // _PyOS_URandomNonblock() #include "structmember.h" // struct PyMemberDef, T_OFFSET_EX #include <stdlib.h> // rand() if (desc_cls == &PyMemberDescr_Type) { P...
<vulnerable_code>/* Map C struct members to Python object attributes */ #include "Python.h" #include "structmember.h" // PyMemberDef PyObject * PyMember_GetOne(const char *obj_addr, PyMemberDef *l) const char* addr = obj_addr + l->offset; switch (l->type) { case T_BOOL: v = PyBool_FromLon...
<vulnerable_code>#include "pycore_parser.h" // _PyParser_ASTFromString() #include "pycore_pystate.h" // _PyThreadState_GET() #include "pycore_symtable.h" // PySTEntryObject #include "structmember.h" // PyMemberDef /* error strings used for warnings */ #define GLOBAL_PARAM \ #define OFF(x) off...
<vulnerable_code> #include "../Parser/pegen.h" // _PyPegen_byte_offset_to_character_offset() #include "frameobject.h" // PyFrame_New() #include "structmember.h" // PyMemberDef #include "osdefs.h" // SEP #ifdef HAVE_FCNTL_H # include <fcntl.h> }; static PyMemberDef tb_memberlist[] =...
<vulnerable_code> return MODULES(interp); } // This is only kept around for extensions that use _Py_IDENTIFIER. PyObject * _PyImport_GetModuleId(_Py_Identifier *nameid) { PyObject *name = _PyUnicode_FromId(nameid); /* borrowed */ if (name == NULL) { return NULL; } return PyImport_GetModule(n...
<vulnerable_code> for rtype, rtype_cache in cache.items(): if rtype_cache: try: warnings.warn('resource_tracker: There appear to be %d ' 'leaked %s objects to clean up at shutdown' % (len(rtype_cac...
<vulnerable_code> return NULL; } hexchars += neg + 2; /* skip sign and "0x" */ mp_init(&bigValue); if (mp_read_radix(&bigValue, hexchars, 16) != MP_OKAY) { mp_clear(&bigValue); Py_DECREF(hexstr); PyErr_NoMemory();<commit_title>[PATCH 016/395] Small fixes to code generator ...
<vulnerable_code> } assert(opcode != 0); assert(!is_instrumented(opcode)); assert(opcode == _PyOpcode_Deopt[opcode]); return 1 + _PyOpcode_Caches[opcode]; }<commit_title>[PATCH 016/395] Small fixes to code generator (#106845)<commit_description>These repair nits I found in PR gh-106798 (issue gh-1067...
<vulnerable_code> @cpython_only @requires_debug_ranges() class CPythonTracebackErrorCaretTests( CAPIExceptionFormattingLegacyMixin, TracebackErrorLocationCaretTestBase, unittest.TestCase,<commit_title>[PATCH 016/395] Small fixes to code generator (#106845)<commit_description>These repair nits I found in PR ...
<vulnerable_code> Protocol, TypeGuard, TypeVar, overload, ) return closure class CConverterAutoRegister(type): def __init__(cls, name, bases, classdict): add_c_converter(cls) add_default_legacy_c_converter(cls) class CConverter(metaclass=CConverterAutoRegister): """ def...
<vulnerable_code> if NoneType in accept and self.c_default == "Py_None": self.c_default = "NULL" def post_parsing(self): if self.encoding: name = self.name return f"PyMem_FREE({name});\n" def parse_arg(self, argname: str, displayname: str) -> str: if ...
<vulnerable_code> class ClinicExternalTest(TestCase): maxDiff = None def _do_test(self, *args, expect_success=True): clinic_py = os.path.join(test_tools.toolsdir, "clinic", "clinic.py") with subprocess.Popen( [sys.executable, "-Xutf8", clinic_py, *args], encoding="utf-8"...
<vulnerable_code> const Tcl_ObjType *WideIntType; const Tcl_ObjType *BignumType; const Tcl_ObjType *ListType; const Tcl_ObjType *ProcBodyType; const Tcl_ObjType *StringType; } TkappObject; v->WideIntType = Tcl_GetObjType("wideInt"); v->BignumType = Tcl_GetObjType("bignum"); v->ListType =...