https://bugs.documentfoundation.org/show_bug.cgi?id=147611
Bug ID: 147611
Summary: UI: Crash when running a macro (regression in 7.3)
Product: LibreOffice
Version: 7.2.5.2 release
Hardware: x86-64 (AMD64)
OS: Linux (All)
Status: UNCONFIRMED
Severity: normal
Priority: medium
Component: Calc
Assignee: [email protected]
Reporter: [email protected]
Description:
I have a file with a specific macro that always crashes Calc with the following
assertion:
/usr/include/c++/11.2.0/bits/stl_vector.h:1045: std::vector<_Tp,
_Alloc>::reference std::vector<_Tp, _Alloc>::operator[](std::vector<_Tp,
_Alloc>::size_type) [with _Tp = ScSortKeyState; _Alloc =
std::allocator<ScSortKeyState>; std::vector<_Tp, _Alloc>::reference =
ScSortKeyState&; std::vector<_Tp, _Alloc>::size_type = long unsigned int]:
Assertion '__n < this->size()' failed.
This is a regression, downgrading to "LibreOffice 7.2.4.1 20(Build:1)" fixes
the problem.
The macro code is the following (not sure if it helps). I don't know where
exactly it crashes:
```
Public Sub GenerateWeeklyReport()
Row_Min = 3 '"Tasks" area starts at Row 3
Row_Max = 62 '"Tasks" area ends at Row 62
Col_TaskNr = 1 '"Task Nr" at Column 1
Col_Task = 2 '"Task Descript" at Column 2
Col_Track = 9 '"Track" at Column 9
Col_TotEff = 20 '"TotEff" at Column 20
Col_WkyEff = 21 '"WkyEff" at Column 21
Col_WkyEffHM = 22 '"WkyEffHM" at Column 22
Col_DoingIt = 23 '"DoingIt" at Column 23
Col_TotPastEff = 24 '"TotPastEff" at Column 24
Col_WkyPastEff = 25 '"WkyPastEff" at Column 25
Col_StartedAt = 26 '"Started At" at Column 26
Set WrkstTasks = Worksheets("tasks")
Set WrkstLog = Worksheets("report")
'clear all
WrkstLog.Range(Cells(1, 1), Cells(Row_Max, 3)).ClearContents
'reset to not bold
WrkstLog.Range(Cells(1, 1), Cells(Row_Max, 3)).Select
Selection.Font.Bold = False
r = 1
TrkAEff = 0#
TrkBEff = 0#
spentMw = 0#
For i = Row_Min To Row_Max
If WrkstTasks.Cells(i, Col_WkyEff) <> "" Then
If WrkstTasks.Cells(i, Col_WkyEff) > 0 Then
taskMw = 0.001 * Int(1000 * (0.2 * WrkstTasks.Cells(i,
Col_WkyEff) + 0.0005))
TaskDes = WrkstTasks.Cells(i, Col_Task)
taskTrk = Left(WrkstTasks.Cells(i, Col_Track), 1)
WrkstLog.Cells(r, 1) = taskTrk
WrkstLog.Cells(r, 2) = taskMw
WrkstLog.Cells(r, 3) = TaskDes
If taskTrk = "A" Then
TrkAEff = TrkAEff + taskMw
End If
If taskTrk = "B" Then
TrkBEff = TrkBEff + taskMw
End If
spentMw = spentMw + taskMw
r = r + 1
End If
End If
Next i
' print total
r2 = r
WrkstLog.Cells(r2, 2) = spentMw
WrkstLog.Cells(r2, 3) = "Total"
' print availability
r2 = r2 + 1
If spentMw <> 0 Then
WrkstLog.Cells(r2, 2) = 100 * TrkAEff / spentMw
Else
WrkstLog.Cells(r2, 2) = 0
End If
WrkstLog.Cells(r2, 3) = "Track A load so far (in percentage)"
r2 = r2 + 1
If spentMw <> 0 Then
WrkstLog.Cells(r2, 2) = 100 * TrkBEff / spentMw
Else
WrkstLog.Cells(r2, 2) = 0
End If
WrkstLog.Cells(r2, 3) = "Track B load so far (in percentage)"
' Bold Total and Availability rows
WrkstLog.Range(Cells(r, 1), Cells(r2, 3)).Select
Selection.Font.Bold = True
'--- re-sort by time-spent in the task ---
If r <> 1 Then
Calculate
'ActiveSheet.Unprotect
Range(Cells(1, 1), Cells(r - 1, 3)).Select
Selection.Sort Key1:=Range("B1"), Header:=False, Order1:=xlDescending,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
'ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True
WrkstLog.Cells(1, 3).Select
'Response = MsgBox("Copying report to clipboard. OK to proceed. Cancel
will not copy.", vbOKCancel, "Copying report to clipboard")
'If Response = vbOK Then
If WrkstLog.Cells(7, 14) = True Then
WrkstLog.Activate
WrkstLog.Range(Cells(1, 2), Cells(r - 1, 3)).Select
Selection.Copy
WrkstLog.Cells(1, 3).Select
End If
End If
End Sub
```
Steps to Reproduce:
1. Click the form button that runs the macro
Actual Results:
1. Program crashes with assertion
Expected Results:
1. Execute the macro as before.
Reproducible: Always
User Profile Reset: Yes
Additional Info:
Crashing Version:
Version: 7.3.0.3 / LibreOffice Community
Build ID: 30(Build:3)
CPU threads: 4; OS: Linux 5.16; UI render: default; VCL: gtk3
Locale: pt-PT (en_GB.UTF-8); UI: en-GB
7.3.0-5
Calc: threaded
Working Version:
Version: 7.2.4.1 / LibreOffice Community
Build ID: 20(Build:1)
CPU threads: 4; OS: Linux 5.16; UI render: default; VCL: gtk3
Locale: pt-PT (en_GB.UTF-8); UI: en-GB
7.2.4-3
Calc: threaded
I'm using Arch Linux.
--
You are receiving this mail because:
You are the assignee for the bug.