Bug 88953 - GetExitCodeProcess call crashes Calc 4.4.0 but not 4.3.5, 4.3.4 or earlier
Summary: GetExitCodeProcess call crashes Calc 4.4.0 but not 4.3.5, 4.3.4 or earlier
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
4.4.0.3 release
Hardware: All Windows (All)
: medium major
Assignee: Caolán McNamara
URL:
Whiteboard: target:5.3.0 target:5.2.1 target:5.1.6
Keywords: haveBacktrace, notBibisectable, regression
Depends on:
Blocks:
 
Reported: 2015-01-30 17:00 UTC by Roman Polach
Modified: 2016-10-21 15:57 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Example of crashing Calc 4.4.0 but not earlier releases (13.27 KB, application/vnd.oasis.opendocument.spreadsheet)
2015-01-30 17:00 UTC, Roman Polach
Details
backtrace from Windbg.txt (10.99 KB, text/plain)
2016-04-02 11:48 UTC, Timur
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Roman Polach 2015-01-30 17:00:40 UTC
Created attachment 112967 [details]
Example of crashing Calc 4.4.0 but not earlier releases

Call of GetExitCodeProcess system function (kernel32) crashes Calc 4.4.0.3 (final).
There is no crash with releases 4.3.5, 4.3.4 or earlier.
See attached example Or12.ods: Steps to reproduce:
* Fill the application path and press the button.
4.4.0 crashes, other versions (including ancient ones) do not.

---------------------------
code from the example file:
---------------------------

Declare Function CreateProcessA Lib "kernel32" (ByVal _
  lpApplicationName As Long, ByVal lpCommandLine As String, ByVal _
  lpProcessAttributes As Long, ByVal lpThreadAttributes As Long, _
  ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, _
  ByVal lpEnvironment As Long, ByVal lpCurrentDirectory As Long, _
  lpStartupInfo As STARTUPINFO, lpProcessInformation As _
  PROCESS_INFORMATION) As Long
Declare Function GetExitCodeProcess Lib "kernel32" _
  (ByVal hProcess As Long, lpExitCode As Long) As Long
Const STILL_ACTIVE = &H103
Const PROCESS_QUERY_INFORMATION = &H400

Type STARTUPINFO
  cb As Long
  lpReserved As String
  lpDesktop As String
  lpTitle As String
  dwX As Long
  dwY As Long
  dwXSize As Long
  dwYSize As Long
  dwXCountChars As Long
  dwYCountChars As Long
  dwFillAttribute As Long
  dwFlags As Long
  wShowWindow As Integer
  cbReserved2 As Integer
  lpReserved2 As Long
  hStdInput As Long
  hStdOutput As Long
  hStdError As Long
End Type
Type PROCESS_INFORMATION
  hProcess As Long
  hThread As Long
  dwProcessID As Long
  dwThreadID As Long
End Type
Const NORMAL_PRIORITY_CLASS = &H20&
Function ShellWithWait(ProgLine As String) As Boolean
  Dim proc As PROCESS_INFORMATION
  Dim start As STARTUPINFO
  Dim iA As Integer
  Dim hProcess As Long, RetVal As Long, RetC As Long, sss As Long, ttt As Long
  On Error GoTo ErrorHandler
  start.cb = 68
  RetC = CreateProcessA(0&, ProgLine, 0&, 0&, 1&, _
    NORMAL_PRIORITY_CLASS, 0&, 0&, start, proc)
  If RetC = 0 Then
    MsgBox("An error (code " & RetC & ") occured during process creation of program " & ProgLine)
    ShellWithWait = False
  End If
  Do
    GetExitCodeProcess(proc.hProcess, RetVal)
    DoEvents
  Loop While RetVal = STILL_ACTIVE
  ShellWithWait = True
exitProc:
  Exit Function
ErrorHandler:
  Select Case Err
    Case Else
      MsgBox("Error no. " & Err & " occured during starting program " & ProgLine)
      ShellWithWait = False
      Resume exitProc
  End Select
  Resume
End Function

Sub ButtonClicked
  Dim Sh As Object, Cl As Object
  Set Sh = ThisComponent.getSheets().getByName("ABC")
  Set Cl = Sh.getCellByPosition(0, 0)  
  ShellWithWait(Cl.String)
End Sub
Comment 1 raal 2015-01-30 19:41:44 UTC
I can confirm crash with Version: 4.5.0.0.alpha0+
Build ID: 784d069cc1d9f1d6e6a4e543a278376ab483d1eb
TinderBox: Win-x86@42, Branch:master, Time: 2015-01-25_23:06:11
Comment 2 Roman Polach 2015-02-16 14:25:49 UTC
The problem is still present in 4.4.1.1 (rc1).
Comment 3 Roman Polach 2015-02-27 14:36:44 UTC
The problem is still present in 4.4.1 final release.
Comment 4 Roman Polach 2015-04-03 15:16:05 UTC
Still crashing with 4.4.2.2 (aka 4.4.2 final).
Does anybody care?
Comment 5 Roman Polach 2015-04-22 12:06:51 UTC
Still crashing with 4.4.3.1.
Comment 6 Roman Polach 2015-05-11 15:54:33 UTC
Still crashing with 4.4.3 final.
Comment 7 Roman Polach 2015-05-25 12:09:09 UTC
Still crashing in 5.0.0.0beta1.
Comment 8 Roman Polach 2015-07-01 14:28:09 UTC
This regression bug is still causing crash - now with 4.4.4 final.
Comment 9 Roman Polach 2015-08-04 13:34:24 UTC
This regression bug is still causing crash - now with 4.4.5 final.
Comment 10 Roman Polach 2015-08-05 14:11:54 UTC
This regression bug is still causing crash - now with 5.0.0 final.
Comment 11 Julien Nabet 2015-12-05 00:15:31 UTC
It could be interesting to retrieve a bt (see https://wiki.documentfoundation.org/QA/BugReport/Debug_Information#Windows:_How_to_get_a_backtrace)
Comment 12 Robinson Tryon (qubit) 2015-12-10 01:26:38 UTC Comment hidden (obsolete)
Comment 13 Cor Nouws 2016-03-28 21:07:13 UTC
Component Basic fits better.
Comment 14 Timur 2016-04-02 11:48:09 UTC
Created attachment 124027 [details]
backtrace from Windbg.txt

sblo.dll dllmgr_call32
Comment 15 Caolán McNamara 2016-08-19 17:30:42 UTC
Fixed with https://cgit.freedesktop.org/libreoffice/core/commit/?id=4a647a04a7881964ce13b541399f89e4ab042ea8 5-2 and 5-1 backports in gerrit
Comment 16 Commit Notification 2016-08-24 23:32:34 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-5-2-1":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=a5dfea5a55cce6db0ca002f56e57a6f522a717eb&h=libreoffice-5-2-1

Resolves: tdf#88953 byref args incorrectly passed in basic->c++

It will be available in 5.2.1.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 17 Commit Notification 2016-08-24 23:32:52 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-5-2":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=23fab7af86ac9655832ac83aa4c1e3fb464e852d&h=libreoffice-5-2

Resolves: tdf#88953 byref args incorrectly passed in basic->c++

It will be available in 5.2.2.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 18 Julien Nabet 2016-08-25 05:35:55 UTC
Let's simplify a bit.
Comment 19 Commit Notification 2016-08-25 11:35:33 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-5-1":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=4221a87f03d823f9f8c8b92d5fba42bd359152fe&h=libreoffice-5-1

Resolves: tdf#88953 byref args incorrectly passed in basic->c++

It will be available in 5.1.6.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 20 pierre-yves samyn 2016-10-21 15:57:48 UTC
Hi

Crash still reproduced on windows 7/64 &  Version: 5.2.0.1 (x64)
Build ID: fcbcb4963bda8633ba72bd2108ca1e802aad557d
CPU Threads: 2; OS Version: Windows 6.1; UI Render: default; 
Locale: fr-FR (fr_FR)

But Verified *no crash* on windows 7/64 & Version: 5.3.0.0.alpha1+
Build ID: 8a796410ec8f440b4163b15b928347c499da7a8f
CPU Threads: 2; OS Version: Windows 6.1; UI Render: default; 
TinderBox: Win-x86@42, Branch:master, Time: 2016-10-20_23:07:21
Locale: fr-FR (fr_FR); Calc: group

Regards
Pierre-Yves