发布时间:2025-12-09 11:52:14 浏览次数:2
import soot.jimple.infoflow.Infoflow; //导入依赖的package包/类@Overridepublic boolean equals(Object other) {if (this == other)return true;if (other == null || getClass() != other.getClass())return false;SourceContextAndPath scap = (SourceContextAndPath) other;if (this.hashCode != 0 && scap.hashCode != 0 && this.hashCode != scap.hashCode)return false;if (this.callStack == null) {if (scap.callStack != null)return false;}else if (!this.callStack.equals(scap.callStack))return false;if (!Infoflow.getPathAgnosticResults() && !this.path.equals(scap.path))return false;return super.equals(other);} import soot.jimple.infoflow.Infoflow; //导入依赖的package包/类@Overridepublic boolean equals(Object o) {if (super.equals(o))return true;if (o == null || !(o instanceof ResultSinkInfo))return false;ResultSinkInfo si = (ResultSinkInfo) o;if (this.sink == null) {if (si.sink != null)return false;}else if (!this.sink.equals(si.sink))return false;return !Infoflow.getOneResultPerAccessPath()|| this.accessPath.equals(si.accessPath);} import soot.jimple.infoflow.Infoflow; //导入依赖的package包/类@Test(timeout=300000) public void parameterFlowTest(){ Infoflow infoflow = initInfoflow(true); List<String> epoint = new ArrayList<String>(); epoint.add("<soot.jimple.infoflow.test.InFunctionCode: int paraToParaFlow(int,int," + "soot.jimple.infoflow.test.InFunctionCode$DataClass," + "soot.jimple.infoflow.test.InFunctionCode$DataClass)>"); DefaultSourceSinkManager ssm = new DefaultSourceSinkManager(sources, sinks); ssm.setParameterTaintMethods(epoint); ssm.setReturnTaintMethods(epoint); infoflow.computeInfoflow(appPath, libPath, new DefaultEntryPointCreator(epoint), ssm); Assert.assertNotNull(infoflow.getResults());Assert.assertTrue(infoflow.getResults().isPathBetween("b", SOURCE_INT_PARAMETER2));Assert.assertFalse(infoflow.getResults().isPathBetween("b", SOURCE_INT_PARAMETER)); } import soot.jimple.infoflow.Infoflow; //导入依赖的package包/类@Test(timeout=300000) public void concreteLinkedSetPos0Test(){ System.out.println("Running test case concreteLinkedSetPos0Test..."); Infoflow infoflow = initInfoflow(); int oldAPLength = Infoflow.getAccessPathLength(); Infoflow.setAccessPathLength(1); List<String> epoints = new ArrayList<String>(); epoints.add("<soot.jimple.infoflow.test.SetTestCode: void concreteWriteReadLinkedPos0Test()>");infoflow.computeInfoflow(appPath, libPath, epoints, sources, sinks);checkInfoflow(infoflow, 1);Infoflow.setAccessPathLength(oldAPLength);// this is a global setting! Restore it when we're doneSystem.out.println("Test case concreteLinkedSetPos0Test done."); } import soot.jimple.infoflow.Infoflow; //导入依赖的package包/类@Test(timeout=300000) public void setIteratorTest(){ System.out.println("Running test case setIteratorTest..."); Infoflow infoflow = initInfoflow(); int oldAPLength = Infoflow.getAccessPathLength(); Infoflow.setAccessPathLength(1); List<String> epoints = new ArrayList<String>(); epoints.add("<soot.jimple.infoflow.test.SetTestCode: void iteratorTest()>");infoflow.computeInfoflow(appPath, libPath, epoints, sources, sinks);checkInfoflow(infoflow, 1);Infoflow.setAccessPathLength(oldAPLength);// this is a global setting! Restore it when we're doneSystem.out.println("Test case setIteratorTest done."); }