diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2022-06-09 16:50:41 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2022-06-10 13:14:31 +0200 |
commit | 52df3b8f64d08f412d7f8b12d82fc0ae6f3c741d (patch) | |
tree | 1dfad8629df87a9d5655051807dbb735020fe525 /sources | |
parent | 03928069a6781a1849245e6219f9caa64093068e (diff) |
libshiboken: Fix a crash in Shiboken::Object::isValid() for Python 3.11
The function is passed type objects for class methods, which caused
it to crash.
The first clause did not catch this, and so it was cast to SbkObject
below.
Add a type check to prevent this.
Pick-to: 6.3 6.2 5.15
Task-number: PYSIDE-1960
Change-Id: Icfdd6fefb7156ac5961444bd5395109849a1d66e
Reviewed-by: Christian Tismer <tismer@stackless.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'sources')
-rw-r--r-- | sources/shiboken6/libshiboken/basewrapper.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/sources/shiboken6/libshiboken/basewrapper.cpp b/sources/shiboken6/libshiboken/basewrapper.cpp index d93f9b214..fce6984c9 100644 --- a/sources/shiboken6/libshiboken/basewrapper.cpp +++ b/sources/shiboken6/libshiboken/basewrapper.cpp @@ -1241,6 +1241,7 @@ bool setCppPointer(SbkObject *sbkObj, PyTypeObject *desiredType, void *cptr) bool isValid(PyObject *pyObj) { if (!pyObj || pyObj == Py_None + || PyType_Check(pyObj) != 0 || Py_TYPE(Py_TYPE(pyObj)) != SbkObjectType_TypeF()) { return true; } |