Skip to content
This repository was archived by the owner on May 18, 2019. It is now read-only.

Commit 75c94ec

Browse files
adeas31OpenModelica-Hudson
authored andcommitted
Restrict instantiateModel based on the access annotation
If the class is encrypted then check the access level for instantiateModel Belonging to [master]: - #2541
1 parent bc961b4 commit 75c94ec

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

Compiler/Script/CevalScriptBackend.mo

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -756,7 +756,6 @@ algorithm
756756
SourceInfo info;
757757
SymbolTable forkedSymbolTable;
758758

759-
760759
case (cache,_,"runScriptParallel",{Values.ARRAY(valueLst=vals),Values.INTEGER(i),Values.BOOL(true)},_)
761760
equation
762761
strs = List.map(vals,ValuesUtil.extractValueString);
@@ -1700,6 +1699,16 @@ algorithm
17001699
simValue = createSimulationResultFailure(res, simOptionsAsString(vals));
17011700
then (cache,simValue);
17021701

1702+
// handle encryption
1703+
case (cache,_,"instantiateModel",_,_)
1704+
equation
1705+
// if AST contains encrypted class show nothing
1706+
p = SymbolTable.getAbsyn();
1707+
true = Interactive.astContainsEncryptedClass(p);
1708+
Error.addMessage(Error.ACCESS_ENCRYPTED_PROTECTED_CONTENTS, {});
1709+
then
1710+
(cache,Values.STRING(""));
1711+
17031712
case (cache,env,"instantiateModel",{Values.CODE(Absyn.C_TYPENAME(className))},_)
17041713
equation
17051714
ExecStat.execStatReset();

0 commit comments

Comments
 (0)