diff options
author | Christian Tismer <tismer@stackless.com> | 2019-04-12 10:58:02 +0200 |
---|---|---|
committer | Christian Tismer <tismer@stackless.com> | 2019-04-16 08:07:38 +0000 |
commit | c9f522f082485186dcd8be80186e3c11b55f2b77 (patch) | |
tree | 24a95c682a4ba6ce712c229228c7b74e733b67f8 /sources/shiboken2/libshiboken/basewrapper.cpp | |
parent | e0aa898c068006a7b6aef4cdb0528f2d0b8e0a94 (diff) |
Ensure that signature strings never overflow again
The signature module used to use large strings with the signatures
of all functions in a class. This can lead to an overflow in MSVC,
because the maximum string length funnily still is 32K unicode
characters.
This patch solves that by using a single string per function.
Instead of a huge string, a list of strings is passed to each class.
To prevent any runtime increase, the string list creation is deferred
until the actual usage. At initialization time only a ssize_t holding
the structure address is passed.
As a result, the signature module should be even slightly faster.
Task-number: PYSIDE-955
Change-Id: I99faf942a3cca03456928b8aec5e8a4b9924b8b2
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources/shiboken2/libshiboken/basewrapper.cpp')
-rw-r--r-- | sources/shiboken2/libshiboken/basewrapper.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sources/shiboken2/libshiboken/basewrapper.cpp b/sources/shiboken2/libshiboken/basewrapper.cpp index db65ec696..3a043d849 100644 --- a/sources/shiboken2/libshiboken/basewrapper.cpp +++ b/sources/shiboken2/libshiboken/basewrapper.cpp @@ -744,7 +744,7 @@ introduceWrapperType(PyObject *enclosingObject, const char *typeName, const char *originalName, PyType_Spec *typeSpec, - const char *signaturesString, + const char *signatureStrings[], ObjectDestructor cppObjDtor, SbkObjectType *baseType, PyObject *baseTypes, @@ -765,7 +765,7 @@ introduceWrapperType(PyObject *enclosingObject, } } // PYSIDE-510: Here is the single change to support signatures. - if (SbkSpecial_Type_Ready(enclosingObject, reinterpret_cast<PyTypeObject *>(type), signaturesString) < 0) + if (SbkSpecial_Type_Ready(enclosingObject, reinterpret_cast<PyTypeObject *>(type), signatureStrings) < 0) return nullptr; initPrivateData(type); |