Bug 135639 - Crash inspecting an array after Redim Statement with option VBASupport 1
Summary: Crash inspecting an array after Redim Statement with option VBASupport 1
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
6.4.4.2 release
Hardware: All All
: medium normal
Assignee: Mike Kaganski
URL:
Whiteboard: target:7.1.0 target:7.0.1 target:6.4.7
Keywords:
Depends on:
Blocks:
 
Reported: 2020-08-11 14:17 UTC by Vladimir Sokolinskiy
Modified: 2020-08-13 15:36 UTC (History)
2 users (show)

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 Vladimir Sokolinskiy 2020-08-11 14:17:23 UTC
Basic:

Option VbaSupport 1
Sub TestRedim4
  Dim arr1, arr2(0)
  arr1=arr2
  Redim arr2(0)    
  Msgbox arr1(0)
End Sub

Error in string with Msgbox:
Runtime error 9. "Index out of defined range".

When trying to view the arr1 value through the Basic debugger (just before the Msgbox), the application crashes
Comment 1 Mike Kaganski 2020-08-11 15:17:56 UTC
This seems to describe two different problems: an unexpected result of accessing arr1 elements in code, and a crash doing that in IDE's watch.

Let this be about the crash (more severe); please file another bug about unexpected operation of the array assignment (with description of the expected result).

https://gerrit.libreoffice.org/c/core/+/100540
Comment 2 Xisco Faulí 2020-08-11 15:23:01 UTC
Reproduced in

Version: 7.1.0.0.alpha0+
Build ID: 0de191e1d201d691c2196cf1aef412a98affb66f
CPU threads: 4; OS: Linux 4.19; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded

Steps to reproduce:
1. Open Writer
2. Tools - Macros - Edit Macros
3. Paste code from description
4. Set a breakpoint at line: Msgbox arr1(0)
5. Run code
6. Select arr1 and press F7
7. Expand Variable tree

-> Crash
Comment 3 Commit Notification 2020-08-11 19:38:18 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/b71815a8d49f95657ce8253434187827e63a5ade

tdf#135639: check the return value of GetDim32

It will be available in 7.1.0.

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

Affected users are encouraged to test the fix and report feedback.
Comment 4 Xisco Faulí 2020-08-12 08:42:40 UTC
Verified in

Version: 7.1.0.0.alpha0+
Build ID: df37937018fe8e87dad5dd97689632044ba56de3
CPU threads: 4; OS: Linux 4.19; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded

@Mike Kaganski, thanks for fixing this issue!!
Comment 5 Commit Notification 2020-08-12 08:44:28 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "libreoffice-7-0":

https://git.libreoffice.org/core/commit/bde75c036f34ce970a90991acde80f0d16007af6

tdf#135639: check the return value of GetDim32

It will be available in 7.0.1.

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

Affected users are encouraged to test the fix and report feedback.
Comment 6 Commit Notification 2020-08-13 15:36:13 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "libreoffice-6-4":

https://git.libreoffice.org/core/commit/575f4ec1dcb0a2dbd80bfaf001a5fc3072cd11fa

tdf#135639: check the return value of GetDim32

It will be available in 6.4.7.

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

Affected users are encouraged to test the fix and report feedback.