Bug 157304 - Macro: Retrieving selected text in FocusIn event for column crashes LO
Summary: Macro: Retrieving selected text in FocusIn event for column crashes LO
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
24.2.0.0 alpha0+
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:24.2.0 target:7.6.2
Keywords:
Depends on:
Blocks:
 
Reported: 2023-09-18 11:19 UTC by Michael Weghorn
Modified: 2023-09-19 10:11 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
Sample document with a macro to trigger the crash (18.65 KB, application/vnd.oasis.opendocument.database)
2023-09-18 11:19 UTC, Michael Weghorn
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Weghorn 2023-09-18 11:19:03 UTC
Created attachment 189667 [details]
Sample document with a macro to trigger the crash

Steps to reproduce

1) in "Tools" -> "Options" -> "LibreOffice(Dev)" -> "Security", set macro security level to "Medium" (or lower) so the document macro is executed
2) open attached sample document "Keypress2.odb" (based on attachment 177721 [details] from tdf#146933), allow macro execution
3) In the "Forms" tab, double-click on "TBL"
4) click in the first table cell to focus that one
5) press Tab key to switch focus to second column

-> LibreOffice crashes (triggered by the macro that is executed when the 2nd column gets focused)

Note: It does not crash when using the gtk3 VCL plugin on Linux (in which case another code path using native Gtk widgets is used).


Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 6f60670877208612b5ea320b3677480ef6508abb
CPU threads: 12; OS: Linux 6.4; UI render: default; VCL: kf5 (cairo+xcb)
Locale: en-GB (en_GB.UTF-8); UI: en-US
Calc: threaded
Comment 1 Michael Weghorn 2023-09-18 11:20:07 UTC
This is with a debug build. Actually, an assertion is triggered:

soffice.bin: .../libreoffice/sal/rtl/strtmpl.hxx:890: void rtl::str::newFromSubString(rtl_tString**, const rtl_tString*, sal_Int32, sal_Int32) [with rtl_tString = _rtl_uString; sal_Int32 = int]: Assertion `false' failed.
Comment 2 Michael Weghorn 2023-09-18 11:39:05 UTC
Pending Gerrit change:
https://gerrit.libreoffice.org/c/core/+/157017
Comment 3 Commit Notification 2023-09-18 15:04:23 UTC
Michael Weghorn committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/489985a6fbba71f74ea343c4162d599eacb9c7d0

tdf#157304 Use normalized selection indices as string indices

It will be available in 24.2.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 Commit Notification 2023-09-19 10:11:30 UTC
Michael Weghorn committed a patch related to this issue.
It has been pushed to "libreoffice-7-6":

https://git.libreoffice.org/core/commit/59a1402455bd03a9839df9133306974a354b6367

tdf#157304 Use normalized selection indices as string indices

It will be available in 7.6.2.

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.