aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2021-09-03 15:12:11 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2021-09-04 10:13:49 +0200
commitf0425d31701d96e8c048b889c9ca8b59e910e043 (patch)
tree345a1f3dd2828b80b29321e979c867ba3179bc93
parent7c122a523d48f56b5a958219a4e3dc6cbc4750dc (diff)
shiboken6: Fix stack-use-after-scope ASAN issues in TypeSystemParser
Remove stream attributes from the attributes list after the stringview has been dealt with. Pick-to: 5.15 Fixes: PYSIDE-1655 Change-Id: Ib50b661e93ca164d68981fc3572cc132412f3302 Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
-rw-r--r--sources/shiboken6/ApiExtractor/typesystemparser.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/sources/shiboken6/ApiExtractor/typesystemparser.cpp b/sources/shiboken6/ApiExtractor/typesystemparser.cpp
index 4b95d2186..7bcf24eab 100644
--- a/sources/shiboken6/ApiExtractor/typesystemparser.cpp
+++ b/sources/shiboken6/ApiExtractor/typesystemparser.cpp
@@ -1360,12 +1360,13 @@ ContainerTypeEntry *
m_error = QLatin1String("no 'type' attribute specified");
return nullptr;
}
- const auto typeName = attributes->takeAt(typeIndex).value();
+ const auto typeName = attributes->at(typeIndex).value();
const auto containerTypeOpt = containerTypeFromAttribute(typeName);
if (!containerTypeOpt.has_value()) {
m_error = QLatin1String("there is no container of type ") + typeName.toString();
return nullptr;
}
+ attributes->removeAt(typeIndex);
auto *type = new ContainerTypeEntry(name, containerTypeOpt.value(),
since, currentParentTypeEntry());
if (!applyCommonAttributes(reader, type, attributes))
@@ -1435,7 +1436,7 @@ NamespaceTypeEntry *
}
result->setFilePattern(re);
} else if (attributeName == QLatin1String("extends")) {
- const auto extendsPackageName = attributes->takeAt(i).value();
+ const auto extendsPackageName = attributes->at(i).value();
auto allEntries = TypeDatabase::instance()->findNamespaceTypes(name);
auto extendsIt = std::find_if(allEntries.cbegin(), allEntries.cend(),
[extendsPackageName] (const NamespaceTypeEntry *e) {
@@ -1446,6 +1447,7 @@ NamespaceTypeEntry *
return nullptr;
}
result->setExtends(*extendsIt);
+ attributes->removeAt(i);
} else if (attributeName == visibleAttribute()) {
const auto attribute = attributes->takeAt(i);
const auto visibilityOpt = visibilityFromAttribute(attribute.value());