mirror of
https://github.com/python/cpython.git
synced 2025-10-14 18:59:46 +00:00
gh-111178: fix UBSan failures in Modules/_sqlite
(GH-129087)
* fix UBSan failures for `pysqlite_Blob` * fix UBSan failures for `pysqlite_Connection` * fix UBSan failures for `pysqlite_Cursor` * fix UBSan failures for `pysqlite_PrepareProtocol` * fix UBSan failures for `pysqlite_Row` * fix UBSan failures for `pysqlite_Statement` * suppress unused return values
This commit is contained in:
parent
9d63ae5fe5
commit
881984b41a
7 changed files with 101 additions and 55 deletions
|
@ -25,6 +25,8 @@
|
|||
#include "statement.h"
|
||||
#include "util.h"
|
||||
|
||||
#define _pysqlite_Statement_CAST(op) ((pysqlite_Statement *)(op))
|
||||
|
||||
/* prototypes */
|
||||
static const char *lstrip_sql(const char *sql);
|
||||
|
||||
|
@ -99,10 +101,11 @@ error:
|
|||
}
|
||||
|
||||
static void
|
||||
stmt_dealloc(pysqlite_Statement *self)
|
||||
stmt_dealloc(PyObject *op)
|
||||
{
|
||||
pysqlite_Statement *self = _pysqlite_Statement_CAST(op);
|
||||
PyTypeObject *tp = Py_TYPE(self);
|
||||
PyObject_GC_UnTrack(self);
|
||||
PyObject_GC_UnTrack(op);
|
||||
if (self->st) {
|
||||
Py_BEGIN_ALLOW_THREADS
|
||||
sqlite3_finalize(self->st);
|
||||
|
@ -114,7 +117,7 @@ stmt_dealloc(pysqlite_Statement *self)
|
|||
}
|
||||
|
||||
static int
|
||||
stmt_traverse(pysqlite_Statement *self, visitproc visit, void *arg)
|
||||
stmt_traverse(PyObject *self, visitproc visit, void *arg)
|
||||
{
|
||||
Py_VISIT(Py_TYPE(self));
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue