From 15c07af2821412abc4fa38a6ca8bfbc2d76b4ff3 Mon Sep 17 00:00:00 2001 From: David Schulz Date: Tue, 30 May 2017 08:34:23 +0200 Subject: [PATCH] Debugger: Filter type names before looking them up Change-Id: I55a705076c635d770c6c0c7cc467c1b30faf6e87 Reviewed-by: Christian Stenger --- src/libs/qtcreatorcdbext/pytype.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/libs/qtcreatorcdbext/pytype.cpp b/src/libs/qtcreatorcdbext/pytype.cpp index 2525a65114e..38bb73bc0f0 100644 --- a/src/libs/qtcreatorcdbext/pytype.cpp +++ b/src/libs/qtcreatorcdbext/pytype.cpp @@ -40,6 +40,8 @@ #include #endif +#include + constexpr bool debugPyType = false; constexpr bool debuggingTypeEnabled() { return debugPyType || debugPyCdbextModule; } @@ -411,6 +413,10 @@ PyType PyType::lookupType(const std::string &typeNameIn, ULONG64 module) if (typeName == "__int64" || typeName == "unsigned __int64") typeName.erase(typeName.find("__"), 2); + const static std::regex typeNameRE("^[a-zA-Z_][a-zA-Z0-9_]*!?[a-zA-Z0-9_<>:, \\*\\&\\[\\]]*$"); + if (!std::regex_match(typeName, typeNameRE)) + return PyType(); + CIDebugSymbols *symbols = ExtensionCommandContext::instance()->symbols(); ULONG typeId; HRESULT result = S_FALSE;