https://bugs.documentfoundation.org/show_bug.cgi?id=152133
Bug ID: 152133
Summary: Stack Protection is not provided for BASIC call to DLL
using declare - lib
Product: LibreOffice
Version: 7.4.2.3 release
Hardware: All
OS: Windows (All)
Status: UNCONFIRMED
Severity: enhancement
Priority: medium
Component: BASIC
Assignee: [email protected]
Reporter: [email protected]
Description:
When a call is made to a function provided by a declaration with a bad
signature:
Public Declare Function WSAStartup Lib "ws2_32.dll" (ByVal wVersionRequested As
Integer, lpWSAData As wsaData) As Long
-- LibreOffice Calc just crashes.
In a similar situation, MS Excel does not crash, because VBA checks and
corrects the stack.
Steps to Reproduce:
1.Type wsaData
wVersion As Integer
wHighVersion As Integer
szDescription As String * WSA_DescriptionSize
szSystemStatus As String * WSA_SysStatusSize
iMaxSockets As Integer
iMaxUdpDg As Integer
lpVendorInfo As String * 200
End Type
Public Declare Function WSAStartup Lib "ws2_32.dll" (ByVal wVersionRequested As
Integer, lpWSAData As wsaData) As Long
Sub Test()
Dim errCode As Integer
Const wsVer22 = 514
Dim SockInfo As wsaData
errCode = WSAStartup(wsVer22, SockInfo)
Exit Sub
2.Call the sub
Actual Results:
LibreOffice crashes and closes.
Expected Results:
Libre Office does not crash.
Reproducible: Always
User Profile Reset: Yes
Additional Info:
There's not much you can do if the stack is corrupted by a call to an external
DLL. But LO should wrap calls to DLL's declared in BASIC, so that LO itself
doesn't crash. Stack faults in this situation should either be ignored, or
cause an orderly shutdown.
The stack protection provided by MS VBA makes calls slower, and requires the
use of LastDLLError (because the wrapper code will lose GetLastError), but that
has not been a cause of complaint.
Version: 7.4.2.3 (x86) / LibreOffice Community
Build ID: 382eef1f22670f7f4118c8c2dd222ec7ad009daf
CPU threads: 4; OS: Windows 6.1 Service Pack 1 Build 7601; UI render:
Skia/Raster; VCL: win
Locale: en-AU (en_AU); UI: en-US
Calc: threaded
--
You are receiving this mail because:
You are the assignee for the bug.