Skip to content

Commit 2483ffb

Browse files
iakovmrbean-bremen
authored andcommitted
CI for CONFIG+=debug + UbSan for tests
Fix UBSAN error for invalid access through pointer. This happens only for Python2 because Py_DECREF is slightly different. Still, I have no opinion if UBSAN is right or wrong here, but this problem occures with the latest XCode/clang available too.
1 parent 17ea22a commit 2483ffb

File tree

2 files changed

+23
-13
lines changed

2 files changed

+23
-13
lines changed

.github/workflows/build.yml

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,10 @@ jobs:
5555
echo ============================
5656
qmake -r PythonQt.pro CONFIG+=release CONFIG+=sanitizer CONFIG+=sanitize_undefined \
5757
PYTHON_VERSION=$(python3 --version | cut -d " " -f 2 | cut -d "." -f1,2) \
58-
PYTHON_DIR=$(which python3 | xargs dirname | xargs dirname)
59-
make -j 2 && make check TESTARGS="-platform offscreen"
58+
PYTHON_DIR=$(which python3 | xargs dirname | xargs dirname)
59+
make -j 2
60+
UBSAN_OPTIONS="halt_on_error=1" ASAN_OPTIONS="detect_stack_use_after_return=1:fast_unwind_on_malloc=0" \
61+
make check TESTARGS="-platform offscreen"
6062
6163
- name: Generate Wrappers
6264
run: |
@@ -86,6 +88,7 @@ jobs:
8688
matrix:
8789
container:
8890
- 'centos:7'
91+
configuration: ['debug', 'release']
8992
runs-on: ubuntu-latest
9093
container: ${{ matrix.container }}
9194
steps:
@@ -113,9 +116,9 @@ jobs:
113116
echo ======= SYSTEM INFO ========
114117
uname -a; gcc --version | grep "gcc"; python --version; qmake-qt5 --version
115118
echo ============================
116-
qmake-qt5 -r PythonQt.pro CONFIG+=release \
117-
PYTHON_VERSION=$(python --version | cut -d " " -f 2 | cut -d "." -f1,2) \
118-
PYTHON_DIR=$(which python | xargs dirname | xargs dirname)
119+
qmake-qt5 -r PythonQt.pro CONFIG+=${{ matrix.configuration }} \
120+
PYTHON_VERSION=$(python --version | cut -d " " -f 2 | cut -d "." -f1,2) \
121+
PYTHON_DIR=$(which python | xargs dirname | xargs dirname)
119122
make -j 2 && make check TESTARGS="-platform offscreen"
120123
121124
- name: Generate Wrappers
@@ -139,13 +142,16 @@ jobs:
139142
macos-version: ['10.15']
140143
python-version: ['2.7']
141144
qt-version: ['5.9.*']
145+
configuration: ['release','debug']
142146
include:
143147
- macos-version: '11'
144148
python-version: '3.6'
145149
qt-version: '5.11.*'
150+
configuration: 'release'
146151
- macos-version: '12'
147152
python-version: '3.11'
148153
qt-version: '5.12.*'
154+
configuration: 'debug'
149155
runs-on: macos-${{ matrix.macos-version }}
150156
steps:
151157
- name: Install Qt
@@ -195,14 +201,17 @@ jobs:
195201
for i in "python${{ steps.versions.outputs.PYTHON_VERSION_SHORT }}-embed" "python${{ steps.versions.outputs.PYTHON_VERSION_SHORT }}" \
196202
"python${PYTHON_VERSION_MAJOR}-embed" "python${PYTHON_VERSION_MAJOR}"
197203
do if pkg-config --exists "$i"; then PYTHON_PKGCONFIG_NAME="$i"; break; fi; done
198-
qmake CONFIG+=release CONFIG+=sanitizer CONFIG+=sanitize_undefined \
199-
PYTHON_VERSION=${{ steps.versions.outputs.PYTHON_VERSION_SHORT }} \
200-
PYTHON_PATH="$pythonLocation" \
201-
PKGCONFIG+=$PYTHON_PKGCONFIG_NAME \
202-
-r PythonQt.pro
203-
make -j 2 && make check TESTARGS="-platform offscreen"
204+
qmake CONFIG+=${{ matrix.configuration }} CONFIG+=sanitizer CONFIG+=sanitize_undefined \
205+
PYTHON_VERSION=${{ steps.versions.outputs.PYTHON_VERSION_SHORT }} \
206+
PYTHON_DIR="$pythonLocation" \
207+
PKGCONFIG+=$PYTHON_PKGCONFIG_NAME \
208+
-r PythonQt.pro
209+
make -j 2
210+
UBSAN_OPTIONS="halt_on_error=1" ASAN_OPTIONS="detect_stack_use_after_return=1:fast_unwind_on_malloc=0" \
211+
make check TESTARGS="-platform offscreen"
204212
205213
- name: Generate Wrappers
214+
if: ${{ contains(matrix.configuration, 'release') }}
206215
run: |
207216
cd generator
208217
# workaround to allow to find the Qt include dirs for installed standard qt packages

src/PythonQtSignal.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,10 @@ PythonQtSignalFunction_New(PythonQtSlotInfo *ml, PyObject *self, PyObject *modul
9999
/* Methods (the standard built-in methods, that is) */
100100

101101
static void
102-
meth_dealloc(PythonQtSignalFunctionObject *m)
102+
meth_dealloc(PyObject *o)
103103
{
104-
PyObject_GC_UnTrack(m);
104+
PyObject_GC_UnTrack(o);
105+
auto m = reinterpret_cast<PythonQtSignalFunctionObject*>(o);
105106
if (m->_dynamicInfo) {
106107
delete m->_dynamicInfo;
107108
m->_dynamicInfo = nullptr;

0 commit comments

Comments
 (0)