path: root/sources/shiboken2/shibokenmodule
diff options
authorChristian Tismer <tismer@stackless.com>2019-04-12 10:58:02 +0200
committerChristian Tismer <tismer@stackless.com>2019-04-16 08:07:38 +0000
commitc9f522f082485186dcd8be80186e3c11b55f2b77 (patch)
tree24a95c682a4ba6ce712c229228c7b74e733b67f8 /sources/shiboken2/shibokenmodule
parente0aa898c068006a7b6aef4cdb0528f2d0b8e0a94 (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/shibokenmodule')
1 files changed, 4 insertions, 10 deletions
diff --git a/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/parser.py b/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/parser.py
index 09e78f1b..72ca3575 100644
--- a/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/parser.py
+++ b/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/parser.py
@@ -224,7 +224,6 @@ def _resolve_type(thing, line):
return _resolve_value(thing, None, line)
def calculate_props(line):
- line = line.strip()
res = _parse_line(line)
arglist = res["arglist"]
annotations = {}
@@ -257,8 +256,7 @@ def calculate_props(line):
props["multi"] = res["multi"]
return props
-def fixup_multilines(sig_str):
- lines = list(line.strip() for line in sig_str.strip().splitlines())
+def fixup_multilines(lines):
res = []
multi_lines = []
for line in lines:
@@ -282,15 +280,11 @@ def fixup_multilines(sig_str):
return res
-def pyside_type_init(typemod, sig_str):
+def pyside_type_init(type_key, sig_strings):
- if type(typemod) is types.ModuleType:
- dprint("Initialization of module '{}'".format(typemod.__name__))
- else:
- dprint("Initialization of type '{}.{}'".format(typemod.__module__,
- typemod.__name__))
+ dprint("Initialization of type key '{}'".format(type_key))
- lines = fixup_multilines(sig_str)
+ lines = fixup_multilines(sig_strings)
ret = {}
multi_props = []
for line in lines: