Crash using QSslCertificate.subjectAlternateNames?
Jeremy Katz
jkatz at volexity.com
Tue Dec 7 23:45:36 GMT 2021
Hi,
I'm seeing a crash calling QSslCertificate.subjectAlternateNames(). It
takes a few calls to fail, but seems to be consistent for a
client:server pair.
Software versions:
macOS 12 or Fedora 32 and 35, Ubuntu 20.04?
PyQt 5.15.[4,5,6]
Qt 5.15.[2,5,7]
Python 3.[7,10]
I've been told that it doesn't occur with PyQt and Qt 5.12.
The Linux stack trace suggests the issue is in PyQt's conversion of the
returned QMultiMap:
#0 _PyObject_GC_UNTRACK
#1 PyObject_GC_UnTrack
#2 subtype_dealloc
#3 convertFrom_QMultiMap_0100QSsl_AlternativeNameEntryType_0100QString
#4 sip_api_convert_from_new_type
#5 meth_QSslCertificate_subjectAlternativeNames
...
The Mac stack trace isn't as obvious to me:
* thread #2, queue = 'com.apple.main-thread', stop reason =
EXC_BAD_ACCESS (code=1, address=0xaa)
* frame #0: Python`_PyType_Lookup + 42
frame #1: Python`_PyObject_LookupSpecial + 40
frame #2: Python`PyObject_Format + 117
frame #3: Python`output_markup + 1176
frame #4: Python`build_string + 393
frame #5: Python`do_string_format + 97
frame #6: Python`_PyMethodDef_RawFastCallKeywords + 685
frame #7: Python`_PyMethodDescr_FastCallKeywords + 82
frame #8: Python`call_function + 780
frame #9: Python`_PyEval_EvalFrameDefault + 25155
frame #10: Python`function_code_fastcall + 128
frame #11: Python`_PyFunction_FastCallDict + 148
frame #12: QtCore.abi3.so`PyQtSlot::call(_object*, _object*) const + 39
frame #13: QtCore.abi3.so`PyQtSlot::invoke(void**, _object*, void*,
bool) const + 374
=== Test program ===
import sys
import PyQt5.QtCore as QtCore
import PyQt5.QtNetwork as QtNetwork
def handleFinished(reply):
while True:
for cert in reply.sslConfiguration().peerCertificateChain():
for k,v in cert.subjectAlternativeNames().items():
print("{}, {}".format(k, v))
app = QtCore.QCoreApplication(sys.argv)
url = QtCore.QUrl(sys.argv[1])
qnam = QtNetwork.QNetworkAccessManager()
qnam.setAutoDeleteReplies(True)
qnam.finished.connect(handleFinished)
request = QtNetwork.QNetworkRequest(url)
qnam.get(request)
app.exec()
=== Example output ===
$ python3 ~/vm_shared/tmp/subjectaltnames.test.py https://www.google.com
1, ['www.google.com']
1, ['www.google.com']
1, ['www.google.com']
Abort trap: 6
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_0x095F4F2148BF111D.asc
Type: application/pgp-keys
Size: 1760 bytes
Desc: OpenPGP public key
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20211207/a79b501d/attachment.key>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 495 bytes
Desc: OpenPGP digital signature
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20211207/a79b501d/attachment.sig>
More information about the PyQt
mailing list