Securiti fix

This commit is contained in:
2018-06-03 14:54:27 +03:00
parent b4da0b0b7a
commit 8b7cc86d23
6 changed files with 65 additions and 18 deletions

View File

@@ -14,9 +14,9 @@ type
TRTBFasmSource=class(TRTBSource) TRTBFasmSource=class(TRTBSource)
protected type protected type
TRTBFasmModule=class(TRTBModule) TRTBFasmModule=class(TRTBModule)
private type protected type
TRTBFasmFunc=class(TRTBFunc) TRTBFasmFunc=class(TRTBFunc)
private protected
p:Pointer; p:Pointer;
public public
constructor Create(p:Pointer); constructor Create(p:Pointer);
@@ -33,7 +33,7 @@ type
constructor Create(p:pointer;&Type:TRTBType); constructor Create(p:pointer;&Type:TRTBType);
destructor Destroy;override; destructor Destroy;override;
end; end;
private protected
p:Pointer; p:Pointer;
sb:NativeUInt; sb:NativeUInt;
funcs:TDictionary<string,NativeUInt>; funcs:TDictionary<string,NativeUInt>;
@@ -341,8 +341,6 @@ else
end; end;
procedure TRTBFasmCompiler.TRTBFasmSource.UnRegisterFunction(NameSpace:string;Name:string); procedure TRTBFasmCompiler.TRTBFasmSource.UnRegisterFunction(NameSpace:string;Name:string);
var
i:NativeUInt;
begin begin
if NameSpace<>'' then if NameSpace<>'' then
Name:=NameSpace+'.'+Name; Name:=NameSpace+'.'+Name;
@@ -535,7 +533,7 @@ function TRTBFasmCompiler.TRTBFasmSource.Compilate:TRTBModule;
PreDecl:=PreDecl+Key+' equ 0'+sLineBreak; PreDecl:=PreDecl+Key+' equ 0'+sLineBreak;
end; end;
var var
templib,pointerDecl,PreDecl:string; pointerDecl,PreDecl:string;
Res:TFasmResult; Res:TFasmResult;
i,base,sb:NativeUInt; i,base,sb:NativeUInt;
FuncDict:TDictionary<string,NativeUInt>; FuncDict:TDictionary<string,NativeUInt>;

View File

@@ -12,12 +12,12 @@ type
TRTBLuaSource=class(TRTBSource) TRTBLuaSource=class(TRTBSource)
protected type protected type
TRTBLuaModule=class(TRTBModule) TRTBLuaModule=class(TRTBModule)
private type protected type
TRTBLuaFunc=class(TRTBFunc) TRTBLuaFunc=class(TRTBFunc)
private protected
//p:Pointer; //p:Pointer;
public public
constructor Create(s:string); //constructor Create(s:string);
//function Call(OutType:PTypeInfo;args:TArray<TValue>;CallType:TRTBCallType=CRTBCallTypeDefault):TValue;override; //function Call(OutType:PTypeInfo;args:TArray<TValue>;CallType:TRTBCallType=CRTBCallTypeDefault):TValue;override;
//destructor Destroy;override; //destructor Destroy;override;
end; end;
@@ -66,6 +66,9 @@ type
//procedure AddConst(NameSpace:string;Name:string;Val:TValue);override; //procedure AddConst(NameSpace:string;Name:string;Val:TValue);override;
//procedure DelConst(NameSpace:string;Name:string);override; //procedure DelConst(NameSpace:string;Name:string);override;
//procedure AddCallBack(NameSpace:string;Name:string;CallBack:TRTBCallBack);override;
//procedure DelCallBack(NameSpace:string;Name:string);override;
//procedure AddVariable(NameSpace:string;Name:string;var Data);override; //procedure AddVariable(NameSpace:string;Name:string;var Data);override;
//procedure ExportVariable(NameSpace:string;Name:string;var Data);override; //procedure ExportVariable(NameSpace:string;Name:string;var Data);override;
//procedure DelVariable(NameSpace:string;Name:string);override; //procedure DelVariable(NameSpace:string;Name:string);override;
@@ -615,7 +618,7 @@ with consts do
with Items[i] do with Items[i] do
ConstParse(Key,Value,PreDecl,base);} ConstParse(Key,Value,PreDecl,base);}
Result:=TRTBLuaModule.Create(FText,funcs); //Result:=TRTBLuaModule.Create(FText,funcs);
end; end;
destructor TRTBLuaCompiler.TRTBLuaSource.Destroy; destructor TRTBLuaCompiler.TRTBLuaSource.Destroy;

View File

@@ -485,13 +485,13 @@ begin
<Operation>1</Operation> <Operation>1</Operation>
</Platform> </Platform>
</DeployClass> </DeployClass>
<ProjectRoot Platform="OSX32" Name="$(PROJECTNAME)"/> <ProjectRoot Platform="iOSDevice32" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="Android" Name="$(PROJECTNAME)"/> <ProjectRoot Platform="Android" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="Win32" Name="$(PROJECTNAME)"/> <ProjectRoot Platform="Win32" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="iOSDevice64" Name="$(PROJECTNAME).app"/> <ProjectRoot Platform="iOSDevice64" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="OSX32" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="Win64" Name="$(PROJECTNAME)"/> <ProjectRoot Platform="Win64" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="iOSSimulator" Name="$(PROJECTNAME).app"/> <ProjectRoot Platform="iOSSimulator" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="iOSDevice32" Name="$(PROJECTNAME).app"/>
</Deployment> </Deployment>
<Platforms> <Platforms>
<Platform value="OSX32">False</Platform> <Platform value="OSX32">False</Platform>

View File

@@ -27,11 +27,21 @@ var
begin begin
Fasm:=TRTBFasmCompiler.Create('..\..\..\lib\FasmOnDelphi\fasmw172\fasm'); Fasm:=TRTBFasmCompiler.Create('..\..\..\lib\FasmOnDelphi\fasmw172\fasm');
Src:=Fasm.GenNewSrc; Src:=Fasm.GenNewSrc;
Src.Text:='use32'+sLineBreak+'main:'+sLineBreak+'pop ecx'+sLineBreak+'pop eax'+sLineBreak+'jmp ecx'+sLineBreak+'Pmain dd 0'+ with Src do
sLineBreak+'varmain:'+sLineBreak+'mov eax,[Pmain]'+sLineBreak+'ret'; begin
Src.RegisterFunction('','main'); Text:='use32'+sLineBreak+
Src.RegisterFunction('','varmain'); 'main:'+sLineBreak+
Src.Register('','Pmain',TypeInfo(integer)); 'pop ecx'+sLineBreak+
'pop eax'+sLineBreak+
'jmp ecx'+sLineBreak+
'Pmain dd 0'+sLineBreak+
'varmain:'+sLineBreak+
'mov eax,[Pmain]'+sLineBreak+
'ret';
RegisterFunction('','main');
RegisterFunction('','varmain');
Register('','Pmain',TypeInfo(integer));
end;
Module:=Src.Compilate; Module:=Src.Compilate;
Func1:=Module.Funtion['main']; Func1:=Module.Funtion['main'];
Func2:=Module.Funtion['varmain']; Func2:=Module.Funtion['varmain'];

View File

@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<test-results name="W:\RuntimeBuilder\Tests\Win64\Debug\Project2.exe" total="2" errors="2" failures="0" ignored="0" inconclusive="0" not-run="0" skipped="0" invalid="0" date="2018-06-03" time="0.107">
<culture-info current-culture="en" current-uiculture="en" />
<test-suite type="Assembly" name="Project2.exe" executed="true" result="Failure" success="False" time="0.107" asserts="0">
<results>
<test-suite type="Namespace" name="Unit1" executed="true" result="Success" success="True" time="0.107" asserts="0" >
<results>
<test-suite type="Fixture" name="TRuntimeBuilderTestObject" executed="True" result="Success" success="True" time="0.107" >
<results>
<test-case name="FasmTest." executed="True" result="Error" success="False" time="0.083" asserts="0" >
<failure>
<message>
<![CDATA[ Error in FasmTest ]]>
</message>
<stack-trace>
<![CDATA[ ]]>
</stack-trace>
</failure>
</test-case>
<test-case name="LuaTest." executed="True" result="Error" success="False" time="0.023" asserts="0" >
<failure>
<message>
<![CDATA[ Abstract Error ]]>
</message>
<stack-trace>
<![CDATA[ ]]>
</stack-trace>
</failure>
</test-case>
</results>
</test-suite>
</results>
</test-suite>
</results>
</test-suite>
</test-results>