Skip to content

Commit 31eb3ed

Browse files
committed
fix: forbid non-dollar names starting with $
1 parent b7b8834 commit 31eb3ed

3 files changed

Lines changed: 19 additions & 4 deletions

File tree

check/fixes.frm

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4461,6 +4461,21 @@ assert warning?("Excess information in symmetric properties")
44614461
assert warning?("Illegal information in number of arguments properties")
44624462
assert warning?("Undefined $-variable")
44634463
*--#] Issue766 :
4464+
*--#[ Issue782 :
4465+
S $s;
4466+
V $v;
4467+
I $i;
4468+
F $f;
4469+
Set $ss;
4470+
Local $test = 1;
4471+
.end
4472+
assert compile_error?("Illegally formed name in symbol statement")
4473+
assert compile_error?("Illegally formed name in vector statement")
4474+
assert compile_error?("Illegally formed name in index statement")
4475+
assert compile_error?("Illegally formed function/tensor name")
4476+
assert compile_error?("Illegal name for set")
4477+
assert compile_error?("Illegal name for expression")
4478+
*--#] Issue782 :
44644479
*--#[ Issue796 :
44654480
* Regression: the fix for 796 deadlocks here:
44664481
Symbol x;

sources/comexpr.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,11 @@ int DoExpr(UBYTE *inp, int type, int par)
112112
else p++;
113113
}
114114
if ( *p ) { /* Variety with the = sign */
115-
if ( ( q = SkipAName(inp) ) == 0 || q[-1] == '_' ) {
115+
q = SkipAName(inp);
116+
if ( *inp == '$' || q == 0 || q[-1] == '_' ) {
116117
MesPrint("&Illegal name for expression");
117118
error = 1;
118-
if ( q[-1] == '_' ) {
119-
while ( FG.cTable[*q] < 2 || *q == '_' ) q++;
120-
}
119+
return(error);
121120
}
122121
else {
123122
c = *q; *q = 0;

sources/names.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3261,6 +3261,7 @@ int TestName(UBYTE *name)
32613261
}
32623262
while ( *name ) {
32633263
if ( *name == '_' ) return(-1);
3264+
if ( *name == '$' ) return(-1);
32643265
name++;
32653266
}
32663267
return(0);

0 commit comments

Comments
 (0)