diff options
author | Denis Shienkov <denis.shienkov@gmail.com> | 2019-09-23 17:10:30 +0300 |
---|---|---|
committer | Denis Shienkov <denis.shienkov@gmail.com> | 2019-09-25 11:03:16 +0300 |
commit | aa00e8eb623d5cb4ba32860dd3671a87f3763f89 (patch) | |
tree | d05c40d5271434907e03862a92d30dd79845a29b | |
parent | ba7eb7316d8586c6a30e759c26fed30c5b0ff5ae (diff) |
Avoid possible symbol clashes on static builds on Windowsv5.14.0-beta1
We have same 'resolveSymbols' functions names in the global
namespace as in the qtserialport module and as in the qtserialbus
module. This can lead to the arbitrary call of this function from
a different module that can lead to the crash or other issue
(e.g. to this issue QTBUG-78546). So, we can just to rename this
function that solves this issue in the future.
Change-Id: I25f9d2a33c6858c5194d8c76eefd518eecfb6f7b
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
-rw-r--r-- | src/serialport/qserialport_win.cpp | 2 | ||||
-rw-r--r-- | src/serialport/qtntdll_p.h | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/serialport/qserialport_win.cpp b/src/serialport/qserialport_win.cpp index da1e7aae..c0061fc9 100644 --- a/src/serialport/qserialport_win.cpp +++ b/src/serialport/qserialport_win.cpp @@ -246,7 +246,7 @@ bool QSerialPortPrivate::open(QIODevice::OpenMode mode) { { QMutexLocker locker(&helper()->mutex); - static bool symbolsResolved = resolveSymbols(&helper()->ntLibrary); + static bool symbolsResolved = resolveNtdllSymbols(&helper()->ntLibrary); if (!symbolsResolved) { setError(QSerialPortErrorInfo(QSerialPort::OpenError, helper()->ntLibrary.errorString())); diff --git a/src/serialport/qtntdll_p.h b/src/serialport/qtntdll_p.h index a8cdaf6a..2e572017 100644 --- a/src/serialport/qtntdll_p.h +++ b/src/serialport/qtntdll_p.h @@ -123,14 +123,14 @@ typedef VOID (WINAPI *PIO_APC_ROUTINE) ( static fp_##symbolName symbolName; #define RESOLVE_SYMBOL(symbolName) \ - symbolName = reinterpret_cast<fp_##symbolName>(resolveSymbol(ntLibrary, #symbolName)); \ + symbolName = reinterpret_cast<fp_##symbolName>(resolveNtdllSymbol(ntLibrary, #symbolName)); \ if (!symbolName) \ return false; GENERATE_SYMBOL_VARIABLE(ULONG, RtlNtStatusToDosError, NTSTATUS) GENERATE_SYMBOL_VARIABLE(NTSTATUS, NtDeviceIoControlFile, HANDLE, HANDLE, PIO_APC_ROUTINE, PVOID, PIO_STATUS_BLOCK, ULONG, PVOID, ULONG, PVOID, ULONG) -inline QFunctionPointer resolveSymbol(QLibrary *ntLibrary, const char *symbolName) +inline QFunctionPointer resolveNtdllSymbol(QLibrary *ntLibrary, const char *symbolName) { QFunctionPointer symbolFunctionPointer = ntLibrary->resolve(symbolName); if (!symbolFunctionPointer) @@ -139,7 +139,7 @@ inline QFunctionPointer resolveSymbol(QLibrary *ntLibrary, const char *symbolNam return symbolFunctionPointer; } -inline bool resolveSymbols(QLibrary *ntLibrary) +inline bool resolveNtdllSymbols(QLibrary *ntLibrary) { if (!ntLibrary->isLoaded()) { ntLibrary->setFileName(QStringLiteral("ntdll")); |