Bug Report 2001/09/27-v1.0b26-br01


[MAIN]
[News]
[Intro]
[Features]
[Download]
[Installation]
[Support]
[Support+]
[Docu]
[Tutorial]
[Bugs]
[forum ]
[wiki]
[Mirror]
[Authors]
[Future]
[License]
[Win98 Setup Bug]
[Subscribe]
Bug Report id=2001/09/27-v1.0b26-br01
Affected versions:v1.0b26 all variations and presumably all earlier versions
Severity:Severe

Bug Description

ScriptBasic handles real number constants having no exponential part erroneous.

Bug Reason, What Causes the Bug

When a constant is a real number but does not have exponential part the internal variables in the lexical analyzer that should hold the exponent sign and value are not initialized, but used to put calculate the value of the number.

On some platforms this error does not manifest because the default value for these variables were zero or small.

Solution

The next release will deliver a corrected version. Due to the severity of the error a maintenance build, v1.0b27 should be expected.

For those, who are able to edit the source and recompile the code the following patch should be applied:

# diff lexer.c lexer_v1.0b25.c
1040,1041d1039
<       exppart = 0.0;
<       esig = 1;

In other words the two above lines have to be inserted before the line 1040. The corrected code fragment with three lines before and after the inserted two lines:
        for( ch = GETC() ; isdigit(ch) ; ch = GETC() )
          fracpart += (man *= 0.1) * (ch-'0');
        }
      exppart = 0.0;

      esig = 1;
      if( ch == 'E' || ch == 'e' ){
        i = 0; /* this is not an integer anymore if it has exponential part */
        ch = GETC(); /* step over the character E */

Bug Workaround Until Solution is Available

Whenever there is a need for a real number constant in the code use exponential part. For example write 1.0e0 instead of 1.0.

Acknowledgement

Merten Joost [evol@uni-koblenz.de] recognized the error and he also pointed out the bug location and he proposed the solution. Because the variables were automatically initialized to very small values on both Windows NT and on Debian Linux the developers used, the error was not reproducible.

This page was generated January 28, 2010 9:58:42