Bug 62323 - BASIC macro fails when converting a Hex string that is negative on Linux 64bit
Summary: BASIC macro fails when converting a Hex string that is negative on Linux 64bit
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
3.5.7.2 release
Hardware: x86-64 (AMD64) Linux (All)
: medium major
Assignee: Not Assigned
URL:
Whiteboard: target:4.2.0 target:4.1.2 target:4.0.6
Keywords:
Depends on:
Blocks:
 
Reported: 2013-03-14 08:12 UTC by irs
Modified: 2018-12-11 16:53 UTC (History)
3 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 irs 2013-03-14 08:12:14 UTC
Problem Statement: When using the LibreOffice V4.0.1.2 Linux 64-bit/AMD release, the execution of the BASIC macro stream will fail upon the instruction to convert Hex strings of a negative value to a long decimal value.

Program execution is halted and the error message displayed is: “Inadmissible value or data type. Overflow”.

BASIC code that demonstrates the problem:

Sub Example_Code_For_Long()
  dim lngDecimal as long

  ' Testing Positive Hex string converted to long integer - OK:
  lngDecimal = Clng(&H0)
  msgbox "Clng(&H0):	 " & Cstr(lngDecimal) 
  'should be: 0 - OK

  lngDecimal = Clng(&H7FFFFFFF)
  msgbox "Clng(&H7FFFFFFF): " & Cstr(lngDecimal) 
  'should be: 2147483647 - OK

  '=====

  ' Testing Negative Hex string converted to long integer.
  ' Fails with Linux 64-bit/AMD LibreOffice 4.0.1.2 

  lngDecimal = Clng(&HFFFFFFFF)
  msgbox "Clng(&HFFFFFFFF): " & Cstr(lngDecimal) 
  'should be: -1 - Fails with Overflow error

  lngDecimal = Clng(&H80000000)
  msgbox "Clng(CH80000000): " & Cstr(lngDecimal) 
  'should be: -2147483648 - Fails with Overflow error

end sub


Note1: The above code run's OK on the following LibreOffice platforms: 
 LibreOffice 4.0.1.2 on WindowsXP SP3
 LibreOffice 3.6.2.2 on Ubuntu 12.10 (quantal) 32-bit Linux 3.5.0-21
 OpenOffice 3.2.1 on Ubuntu 10.10 (maverick) 32 bit Linux 2.6.35-22 
 LibreOffice 3.3.3 Ubuntu 11.04 (natty) 32-bit Linux 2.6.38-11-generic

Note2: I don't have a Mac to test whether or not this problem exists on the Mac / LibreOffice platform.

Regards, ian.
Comment 1 Joel Madero 2013-03-19 20:33:47 UTC
As you have stated the bug existed in an older release I am updating version. Our version field represents the oldest release we see the problem, not the latest it's been tested on - we use comments to say "still exists in version x.x.x.x). Thanks!
Comment 2 irs 2013-03-19 23:08:13 UTC
Hi Joel,

Thanks for explaining the "Version" field in Bug header section. 

In my comments I stated that the bug does not exist on x86 / 32-bit Linux versions of LibreOffice including V3.3.3 and V3.6.2.2

At the time of posting the comment, I had only one x86-64-bit/AMD Linux system with the 64-bit LibreOffice installed. This was running LibreOffice V4.0.1.2. I was only able to demonstrate and conclude the bug existed on this platform.

I have since located a x86-64 bit/AMD Linux system with 64-bit LibreOffice V3.5.7.2. I can confirm the bug exists on this version of LibreOffice.

It is possibly that this bug has existed since V3.3, the first LibreOffice release, but I don't have a copy of the V3.3 64-bit LibreOffice to be able to perform testing to confirm this. 

At this stage I can only confirm the bug existed as far back as the LibreOffice V3.5.7.2 64-bit Linux edition. I have set the version to reflect this. If someone has older versions of LibreOffice 64-bit edition, and can reproduce this bug, then please update the comments and version field.

thanks, Ian.
Comment 3 Herbert Stalp 2013-08-08 10:46:39 UTC
Problem still exists in Version: 4.1.0.4 Build ID: 89ea49ddacd9aa532507cbf852f2bb22b1ace28
Linux x86-64 AMD OpenSUse 12.3

Have a nice day
Herbert
Comment 4 tommy27 2013-08-18 07:12:37 UTC
I receive no errors on LibO 4.0.4 using Win7 64bit. that's probably a Linux 64bit specific issue.

I changed a little bit the summary notes removing some redundant informations (you can already find them in the platform fields)

changed version to 3.5.7.2 which is the earliest where the issue has been effectively reported.

adding to CC Noel Power who is the expert for basic issues.
Comment 5 Commit Notification 2013-08-20 08:10:19 UTC
Noel Power committed a patch related to this issue.
It has been pushed to "master":

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

fix for fdo#62323 bad conversion of Hex strings for certain values



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 6 Commit Notification 2013-08-20 08:20:42 UTC
Noel Power committed a patch related to this issue.
It has been pushed to "master":

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

fix for fdo#62323 fix duplicated and wrong tests



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 7 Commit Notification 2013-08-20 11:32:07 UTC
Noel Power committed a patch related to this issue.
It has been pushed to "libreoffice-4-1":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=3c3c0c589a5b51797c1b751c712e9fa053ad921f&h=libreoffice-4-1

fix for fdo#62323 bad conversion of Hex strings for certain values


It will be available in LibreOffice 4.1.2.

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 8 Commit Notification 2013-08-20 12:37:33 UTC
Noel Power committed a patch related to this issue.
It has been pushed to "libreoffice-4-0":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=230c28efb7773b89cf36312f722da835bfb90bff&h=libreoffice-4-0

fix for fdo#62323 bad conversion of Hex strings for certain values


It will be available in LibreOffice 4.0.6.

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 9 irs 2014-01-06 08:35:31 UTC
(In reply to comment #8)
> Noel Power committed a patch related to this issue. 
> fix for fdo#62323 bad conversion of Hex strings for certain values
> 
> Affected users are encouraged to test the fix and report feedback.

Hi Noel,

I have tested the BASIC function Clng() for Hex strings of negative value using LibreOffice 4.1.3.2 410m0(Build:2) on Linux 64-bit 13-10 3.11.0-15 and found they now return the correct decimal values.

Many thanks for performing this fix.
regards, Ian.

PS: Is there any chance you could assign yourself to Bug 62326 as this seems to be the same problem, but with the BASIC function Cint() ?