Skip to content

Commit

Permalink
Restrict instantiateModel based on the access annotation
Browse files Browse the repository at this point in the history
If the class is encrypted then check the access level for instantiateModel

Belonging to [master]:
  - OpenModelica/OMCompiler#2541
  • Loading branch information
adeas31 authored and OpenModelica-Hudson committed Jun 29, 2018
1 parent bc961b4 commit 75c94ec
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Compiler/Script/CevalScriptBackend.mo
Expand Up @@ -756,7 +756,6 @@ algorithm
SourceInfo info;
SymbolTable forkedSymbolTable;


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

// handle encryption
case (cache,_,"instantiateModel",_,_)
equation
// if AST contains encrypted class show nothing
p = SymbolTable.getAbsyn();
true = Interactive.astContainsEncryptedClass(p);
Error.addMessage(Error.ACCESS_ENCRYPTED_PROTECTED_CONTENTS, {});
then
(cache,Values.STRING(""));

case (cache,env,"instantiateModel",{Values.CODE(Absyn.C_TYPENAME(className))},_)
equation
ExecStat.execStatReset();
Expand Down

0 comments on commit 75c94ec

Please sign in to comment.