Debugger: Filter type names before looking them up

Change-Id: I55a705076c635d770c6c0c7cc467c1b30faf6e87
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
David Schulz
2017-05-30 08:34:23 +02:00
parent 5a858d7fed
commit 15c07af282

View File

@@ -40,6 +40,8 @@
#include <dbghelp.h>
#endif
#include <regex>
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;