Skip to content

Commit c982339

Browse files
committed
fix: forbid non-dollar names starting with $
1 parent c549571 commit c982339

3 files changed

Lines changed: 18 additions & 1 deletion

File tree

check/fixes.frm

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4448,6 +4448,21 @@ assert warning?("Excess information in symmetric properties")
44484448
assert warning?("Illegal information in number of arguments properties")
44494449
assert warning?("Undefined $-variable")
44504450
*--#] Issue766 :
4451+
*--#[ Issue782 :
4452+
S $s;
4453+
V $v;
4454+
I $i;
4455+
F $f;
4456+
Set $ss;
4457+
Local $test = 1;
4458+
.end
4459+
assert compile_error?("Illegally formed name in symbol statement")
4460+
assert compile_error?("Illegally formed name in vector statement")
4461+
assert compile_error?("Illegally formed name in index statement")
4462+
assert compile_error?("Illegally formed function/tensor name")
4463+
assert compile_error?("Illegal name for set")
4464+
assert compile_error?("Illegal name for expression")
4465+
*--#] Issue782 :
44514466
*--#[ PullReq535 :
44524467
* This test requires more than the specified 50K workspace.
44534468
#:maxtermsize 200

sources/comexpr.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ 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;
118119
if ( q[-1] == '_' ) {

sources/names.c

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

0 commit comments

Comments
 (0)