Bug 166673 - BASIC: Calling Space(-1) succeeds in release version (even in VBA support mode), crashes in debug version
Summary: BASIC: Calling Space(-1) succeeds in release version (even in VBA support mod...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: difficultyBeginner, easyHack, skillCpp
Depends on:
Blocks:
 
Reported: 2025-05-21 11:32 UTC by Mike Kaganski
Modified: 2025-05-22 03:12 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 Mike Kaganski 2025-05-21 11:32:48 UTC
This Basic code succeeds in release version:

 Space(-1)

In release version, this aborts because of failed assertion.

1. In VBA, this code gives Invalid Procedure Call run-time error (5).
We need to do the same in VBASupport mode.

2. We can't do that in non-VBA mode, because there is existing code relying on current behavior. We need to sanitize the passed value instead, so that it reaches the internals, where the "non-negative" preconditions must be met, in a valid state.

Code pointer: SbRtl_Space in basic/source/runtime/methods.cxx.
The patch must contain unit tests both for non-VBA, and VBA support cases.
Comment 1 Mike Kaganski 2025-05-21 12:09:44 UTC
(In reply to Mike Kaganski from comment #0)
> In release version, this aborts because of failed assertion.

A thinko: it was intended to be "In *debug* version, this aborts because of failed assertion"