Bug 118442 - BASIC: Converting a negative number string with decimals to double asserts in debug builds
Summary: BASIC: Converting a negative number string with decimals to double asserts in...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Mike Kaganski
URL:
Whiteboard: target:6.2.0 target:6.1.0.1
Keywords:
Depends on:
Blocks:
 
Reported: 2018-06-29 02:21 UTC by Mike Kaganski
Modified: 2018-07-03 16:59 UTC (History)
1 user (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 2018-06-29 02:21:57 UTC
Running the BASIC code

> Sub Test
>   Dim f As Double
>   f = " -12.20"
> End Sub

brings assert in debug builds:

> ---------------------------
> Microsoft Visual C++ Runtime Library
> ---------------------------
> Assertion failed!
> 
> Program: C:\lo\core\instdir\program\sblo.dll
> File: C:\lo\core\include\rtl/ustrbuf.hxx
> Line: 490
> 
> Expression: index >= 0 && index < pData->length

The problem is that the number string is prepended with spaces and/or minus sign, which is not accounted for in ImpScan in basic/source/sbx/sbxscan.cxx.

https://gerrit.libreoffice.org/56611 fixes this.
Comment 1 Commit Notification 2018-06-29 05:45:34 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=b24b0b9856b42eb6598c053703a11f86b6a6346c

tdf#118442: Fix incorrect index calculation

It will be available in 6.2.0.

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

Affected users are encouraged to test the fix and report feedback.
Comment 2 Commit Notification 2018-07-03 16:59:27 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "libreoffice-6-1":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=ca3786b172a18aadbd3f437048c43724f2b7b69a&h=libreoffice-6-1

tdf#118442: Fix incorrect index calculation

It will be available in 6.1.0.1.

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

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