- Invalid
line numbers or breakpoints
(for
ISDK/Java 4.10c)
Error: When interpreting from source text (instead
of from file) the text in the first line is ignored.
This can manifest as line numbers being invalid,
breakpoints being off, or the script just acting
wacky.
Fix:
In the file Source.java, method "Source(Source PrevSB,
BytePtr SourceText)", delete these lines:
if ( MemoryPtr.cursor > 0 ){
MemoryPtr.shift(-1).setCharAt(0,'\0') ;
}
/* start at line 1 not 0 */
pLine++;
and
replace these lines:
int len = CStringLib.strlen(SourceText)+1 ;
MemoryPtr = new BytePtr( len ) ;
CStringLib.strcpy(MemoryPtr,SourceText);
with
these:
int len = CStringLib.strlen(SourceText)+1+1/*beginning null*/ ;
MemoryPtr = new BytePtr( len ) ;
MemoryPtr.setCharAt(0,'\n');
/* always for first line to be read */
CStringLib.strcpy(MemoryPtr.plus(1),SourceText);
- Parsing
errors
Problem:
Statements such as (SomeFunction)(); generate a
parsing error.
Fix:
In CODE.C function CompileFromText(), "case '('",
at about line 389, replace this statement:
|| EndFunctionCall == Type ) {
with
this statement:
|| EndFunctionCall == Type
|| EndEvaluationGroup == Type ) {
The
fix is nearly identical in the Java version
of CODE.JAVA.
- ISDK
incrementing dynamic object
Problem:
Using the increment or decrement operators on a
property of a dynamic object (i.e., and object with
_get or _put methods) may result in the variable
being replaced by an undefined value. For instance,
this script:
var foo.x = 0;
printf("foo.x++ = " + foo.x++);
printf(" foo.x = " + foo.x);
will
print "0 undefined" if foo._get() returns a newly-created,
temporary variable.
Fix:
in SE:ISDK/C --
..is
in SECODE.C about 5 lines after the statement:
case opPreDecrement:
replace:
if ( VNumber == lVar->varmem->data.vall.dataType )
with:
if ( wVar == lVar /* no dynamic obj happening */
&& VNumber == lVar->varmem->data.vall.dataType )
*
* * * *
Fix:
in SE:ISDK/Java 4.10c --
The
replacement is similar. In secode.java:
replace:
if ( VNumber == lVar.varmem.dataType )
with:
if ( wVar == lVar /* no dynamic obj */
&& VNumber == lVar.varmem.dataType )
- Using
"Delete" Operator On Non-Reference Var
Problem:
the "delete" operator used on a non-reference variable
(e.g. "delete 0", "delete global") will crash the
engine.
Fix:
for ISDK/C --
In the do_op_delete() function of OPERATOR.C, after
reporting the message BAD_DELETE_VAR replace this
line:
return NULL;
with
this:
return constructVarRead(call,VBoolean);
Fix:
for ISDK/Java --
In
the do_op_delete() method of Operator.java, after
reporting the message BAD_DELETE_VAR, replace this
line:
return null;
with
this:
return Var.constructVarRead(call,VBoolean);
- Changing
The Global Object
(In
v4.10c for both ISDK/C and ISDK/Java)
Problem:
user can change the global object from a script,
rendering the entire script object tree invalid
and inevitably leading to a crash. For example,
this script, with "global" being the name of the
global object, will crash the interpreter, probably
in cleanup:
global = 4;
The
solution is to make the global object a Read-Only
variable. This can be fixed from within your application,
after jseInitializeExternalLink(), by setting the
read-only attribute on for the global object.
Fix:
in the core engine for ISDK/C:
In
the NewGlobalVariable() function in UTIL.C add the
following statement after "varAddUser(newGlobalVariable);"
varSetAttributes(newGlobalVariable,jseReadOnly);
=
= = = = = =
Fix:
in the core engine for ISDK/Java
In
the NewGlobalVariable() method of Call.java, add
the following statement after "newGlobalVariable.SetLvalue(true);"
newGlobalVariable.SetAttributes(jseReadOnly);