Bug 160770 - Crashes on second access of regex matches without VBA support option
Summary: Crashes on second access of regex matches without VBA support option
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
7.6.6.3 release
Hardware: All Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: bibisectRequest, regression
Depends on:
Blocks:
 
Reported: 2024-04-22 08:46 UTC by NOYB
Modified: 2024-04-22 09:20 UTC (History)
0 users

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description NOYB 2024-04-22 08:46:27 UTC
Description:
VB macro using RegEx matches.
Calc crashes on second access of regex matches without VBA support option


Steps to Reproduce:
1.Run the attached macro
2.
3.

Actual Results:
Calc application crashes

Expected Results:
Work properly


Reproducible: Always


User Profile Reset: No

Additional Info:
REM  *****  BASIC  *****

' Crashes on second access of regex matches (line 19) without VBA support option.

Private Function RegEx_Matches_Calc_Crash()

    Dim regEx As Object
    Set regEx = CreateObject("VBScript.RegExp")
    regEx.Global = True
    regEx.IgnoreCase = True

	html = "<span>10:35 AM EDT</span>"

    regEx.Pattern = "<span>([0-9]{2}):([0-9]{2}) (AM|PM) (EST|EDT)</span>"
    Set Matches = regEx.Execute(html)

    If Matches.Count > 0 Then
        TimeHour = Matches.Item(0).SubMatches.Item(0)
        TimeHour = Matches.Item(0).SubMatches.Item(0)
        TimeMinute = Matches.Item(0).SubMatches.Item(1)
        TimeAMPM = Matches.Item(0).SubMatches.Item(2)
        TimeTZ = Matches.Item(0).SubMatches.Item(3)
    End If

End Function


' Version: 7.6.6.3 (X86_64) / LibreOffice Community
' Build ID: d97b2716a9a4a2ce1391dee1765565ea469b0ae7
' CPU threads: 8; OS: Windows 10.0 Build 22631; UI render: Skia/Raster; VCL: win
' Locale: en-US (en_US); UI: en-US
' Calc: threaded
Comment 1 Mike Kaganski 2024-04-22 09:20:34 UTC
Repro. This is a two-stage regression (with a brief intermediate breakage).

In OOo 3.2.0 and OOo 3.3.0, it run just fine (and adding a MsgBox to show all four submatches shown them all).

In LO 3.3.0, it started showing an error, no matter how many attempts to run the function:
"BASIC runtime error.
An exception occurred 
Type: com.sun.star.uno.RuntimeException
Message: [automation bridge] unexpected exception in IUnknownWrapper_Impl::getValue ! Message : 
."

In Version 3.4.0, it shown a run-time error on the problematic second TimeHour assignment line on the first function call: "General Error". Then it crashed on a second function run.

In 3.5.0, it restored the behavior of 3.3.0; and worked like that till 7.5.0 (inclusive).

In 7.6.0, it started crashing.

The last regression (crash since 7.6) needs bisection.