当前位置: 首页>>代码示例>>Java>>正文


Java StaticFieldRef类代码示例

本文整理汇总了Java中soot.jimple.StaticFieldRef的典型用法代码示例。如果您正苦于以下问题:Java StaticFieldRef类的具体用法?Java StaticFieldRef怎么用?Java StaticFieldRef使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


StaticFieldRef类属于soot.jimple包,在下文中一共展示了StaticFieldRef类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getPointsToSet

import soot.jimple.StaticFieldRef; //导入依赖的package包/类
/**
 * Gets the points-to-set for the given value
 * @param targetValue The value for which to get the points-to-set
 * @return The points-to-set for the given value
 */
private PointsToSet getPointsToSet(Value targetValue) {
	PointsToAnalysis pta = Scene.v().getPointsToAnalysis();
	synchronized (pta) {			
		if (targetValue instanceof Local)
			return pta.reachingObjects((Local) targetValue);
		else if (targetValue instanceof InstanceFieldRef) {
			InstanceFieldRef iref = (InstanceFieldRef) targetValue;
			return pta.reachingObjects((Local) iref.getBase(), iref.getField());
		}
		else if (targetValue instanceof StaticFieldRef) {
			StaticFieldRef sref = (StaticFieldRef) targetValue;
			return pta.reachingObjects(sref.getField());
		}
		else if (targetValue instanceof ArrayRef) {
			ArrayRef aref = (ArrayRef) targetValue;
			return pta.reachingObjects((Local) aref.getBase());
		}
		else
			throw new RuntimeException("Unexpected value type for aliasing: " + targetValue.getClass());
	}
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:27,代码来源:PtsBasedAliasStrategy.java

示例2: baseMatches

import soot.jimple.StaticFieldRef; //导入依赖的package包/类
/**
 * Checks whether the given base value matches the base of the given
 * taint abstraction
 * @param baseValue The value to check
 * @param source The taint abstraction to check
 * @return True if the given value has the same base value as the given
 * taint abstraction, otherwise false
 */
protected boolean baseMatches(final Value baseValue, Abstraction source) {
	if (baseValue instanceof Local) {
		if (baseValue.equals(source.getAccessPath().getPlainValue()))
			return true;
	}
	else if (baseValue instanceof InstanceFieldRef) {
		InstanceFieldRef ifr = (InstanceFieldRef) baseValue;
		if (ifr.getBase().equals(source.getAccessPath().getPlainValue())
				&& source.getAccessPath().firstFieldMatches(ifr.getField()))
			return true;
	}
	else if (baseValue instanceof StaticFieldRef) {
		StaticFieldRef sfr = (StaticFieldRef) baseValue;
		if (source.getAccessPath().firstFieldMatches(sfr.getField()))
			return true;
	}
	return false;
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:27,代码来源:AbstractInfoflowProblem.java

示例3: jimplify

import soot.jimple.StaticFieldRef; //导入依赖的package包/类
public void jimplify (DexBody body) {
      int source = ((OneRegisterInstruction)instruction).getRegisterA();
      FieldReference f = (FieldReference)((ReferenceInstruction)instruction).getReference();
      StaticFieldRef instanceField = Jimple.v().newStaticFieldRef(getStaticSootFieldRef(f));
      Local sourceValue = body.getRegisterLocal(source);
      assign = getAssignStmt(body, sourceValue, instanceField);
      setUnit(assign);
      addTags(assign);
      body.add(assign);

if (IDalvikTyper.ENABLE_DVKTYPER) {
	Debug.printDbg(IDalvikTyper.DEBUG, "constraint: "+ assign);
        int op = (int)instruction.getOpcode().value;
        DalvikTyper.v().setType(assign.getRightOpBox(), instanceField.getType(), true);
      }
  }
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:17,代码来源:SputInstruction.java

示例4: isParamVulnAndStore

import soot.jimple.StaticFieldRef; //导入依赖的package包/类
@Override
public void isParamVulnAndStore(SootMethod originMethod, Stmt originStmt, Value reachedValue) { //avoid sideeffect
	//constant already guaranteed by caller
	System.out.println(originStmt);
	String funcSig = originStmt.getInvokeExpr().getMethod().getSignature();
	String valueString = reachedValue.toString();
	if (evaluateResult(funcSig, valueString)) {
		if(DEBUG) {
			System.out.println("result found");
			System.out.println("originstmt: " + originStmt + " reachedValue: " + reachedValue);
		}
		this.results.add(new Pair<>(originMethod, new Pair<>(originStmt, valueString)));
	}
	if(DEBUG) {
		if (reachedValue instanceof Constant || reachedValue instanceof StaticFieldRef) {
			System.out.println("originstmt: " + originStmt + " reachedValue: " + reachedValue);
		}
	}
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:20,代码来源:APIVulnManager.java

示例5: checkAccessStmt

import soot.jimple.StaticFieldRef; //导入依赖的package包/类
private void checkAccessStmt(Stmt sootStmt, SootMethod currentMethod)
{
	if(sootStmt.containsFieldRef())
	{
		SootField accessField = sootStmt.getFieldRef().getField();
   		boolean isWrite = (((DefinitionStmt)sootStmt).getLeftOp() instanceof FieldRef);
   		boolean isStatic = (sootStmt.getFieldRef() instanceof StaticFieldRef);
   		Value object = isStatic ? NullConstant.v() : ((InstanceFieldRef)sootStmt.getFieldRef()).getBase();
   		
   		String methodSig = currentMethod.getSignature();
   		
   		List<Value> currentLocks = new ArrayList<Value>(lockStack);
   		
   		System.out.println(isWrite+" access on "+isStatic+" field "+accessField+" of "+object+" in "+methodSig+" with "+currentLocks.size()+" locks");
   		
   		if(!variableAccesses.containsKey(methodSig))
   		{
   			variableAccesses.put(methodSig, new HashSet<VariableAccess>());
   		}
   		variableAccesses.get(currentMethod.getSignature()).add(
   				new VariableAccess(accessField, sootStmt, currentMethod, isWrite, isStatic, currentLocks));
	}
}
 
开发者ID:k4v,项目名称:Sus,代码行数:24,代码来源:BodyAnalysis.java

示例6: caseStaticFieldRef

import soot.jimple.StaticFieldRef; //导入依赖的package包/类
@Override
public void caseStaticFieldRef(StaticFieldRef arg0) {
	// TODO: we are checking if this is a @NonNull field
	// if so, we add an assume to ensure that it actually is
	// not null here. May be better ways to do this.
	checkFieldAnnotations(
			GlobalsCache.v().lookupSootField(arg0.getField()), arg0);
	Expression field = GlobalsCache.v().lookupSootField(arg0.getField());
	// check if the field may be modified by another thread.
	// (unless it is a lhs expression. In that case we don't care.
	if (!this.isLeftHandSide && checkSharedField(arg0, field)) {
		havocField(field, null);
	}

	this.expressionStack.push(field);
}
 
开发者ID:SRI-CSL,项目名称:bixie,代码行数:17,代码来源:SootValueSwitch.java

示例7: getPointsToSet

import soot.jimple.StaticFieldRef; //导入依赖的package包/类
/**
 * Gets the points-to-set for the given value
 * @param targetValue The value for which to get the points-to-set
 * @return The points-to-set for the given value
 */
private PointsToSet getPointsToSet(Value targetValue) {
	if (targetValue instanceof Local)
		return Scene.v().getPointsToAnalysis().reachingObjects((Local) targetValue);
	else if (targetValue instanceof InstanceFieldRef) {
		InstanceFieldRef iref = (InstanceFieldRef) targetValue;
		return Scene.v().getPointsToAnalysis().reachingObjects((Local) iref.getBase(), iref.getField());
	}
	else if (targetValue instanceof StaticFieldRef) {
		StaticFieldRef sref = (StaticFieldRef) targetValue;
		return Scene.v().getPointsToAnalysis().reachingObjects(sref.getField());
	}
	else if (targetValue instanceof ArrayRef) {
		ArrayRef aref = (ArrayRef) targetValue;
		return Scene.v().getPointsToAnalysis().reachingObjects((Local) aref.getBase());
	}
	else
		throw new RuntimeException("Unexpected value type for aliasing: " + targetValue.getClass());
}
 
开发者ID:0-14N,项目名称:soot-inflow,代码行数:24,代码来源:PtsBasedAliasStrategy.java

示例8: addStaticFieldAV

import soot.jimple.StaticFieldRef; //导入依赖的package包/类
public void addStaticFieldAV(StaticFieldRef sfr, AliasValue av){
	Set<AliasValue> avSet = this.staticFieldAVs.get(sfr);
	if(avSet == null){
		avSet = new HashSet<AliasValue>();
		avSet.add(av);
		this.staticFieldAVs.put(sfr, avSet);
	}else{
		boolean isExisted = false;
		for(AliasValue item : avSet){
			if(item.myEquals(av)){
				isExisted = true;
				break;
			}
		}
		if(!isExisted){
			avSet.add(av);
		}
	}
}
 
开发者ID:0-14N,项目名称:soot-inflow,代码行数:20,代码来源:MethodInitState.java

示例9: addStaticFieldAV

import soot.jimple.StaticFieldRef; //导入依赖的package包/类
private void addStaticFieldAV(StaticFieldRef sfr, AliasValue av){
	Set<AliasValue> avSet = this.staticFieldAVs.get(sfr);
	if(avSet == null){
		avSet = new HashSet<AliasValue>();
		avSet.add(av);
		this.staticFieldAVs.put(sfr, avSet);
	}else{
		boolean isExisted = false;
		for(AliasValue item : avSet){
			if(item.myEquals(av)){
				isExisted = true;
				break;
			}
		}
		if(!isExisted){
			avSet.add(av);
		}
	}
}
 
开发者ID:0-14N,项目名称:soot-inflow,代码行数:20,代码来源:PathSummary.java

示例10: foundNewTaint

import soot.jimple.StaticFieldRef; //导入依赖的package包/类
private void foundNewTaint(Unit currUnit, Value lv){
	if(spa.getPathSummary().alreadyInTaintsSet(currUnit, lv)){
		return;
	}
	if(lv instanceof StaticFieldRef){
		spa.getPathSummary().addStaticFieldRefTV((StaticFieldRef) lv);
	}
	//first add the left value to taints set
	TaintValue tv = new TaintValue(currUnit, lv);
	spa.getPathSummary().addTaintValue(tv);
	//then, whether the left value is a FieldRef (only instance field can have alias) TODO
	if(lv instanceof InstanceFieldRef){
		tv.setHeapAssignment(true);
		BackwardAnalysis ba = new BackwardAnalysis(currUnit, tv, spa);
		ba.startBackward();
	}
}
 
开发者ID:0-14N,项目名称:soot-inflow,代码行数:18,代码来源:ForwardAnalysis.java

示例11: assignServiceToField

import soot.jimple.StaticFieldRef; //导入依赖的package包/类
private void assignServiceToField(Body b, SootClass initClass, SootClass sc) {
    Value l = getLocalWithName(b, makeLocalName(sc.getType()), sc.getType());
    SootField f = initClass.getFieldByName(makeFieldName(sc.getType()));
    StaticFieldRef sfr = Jimple.v().newStaticFieldRef(f.makeRef());
    Unit u = Jimple.v().newAssignStmt(sfr, l);
    b.getUnits().add(u);
}
 
开发者ID:Alexandre-Bartel,项目名称:permission-map,代码行数:8,代码来源:GenerateServiceInit.java

示例12: hasPrefix

import soot.jimple.StaticFieldRef; //导入依赖的package包/类
public boolean hasPrefix(Value v) { // if this has prefix v
	if (v instanceof Local) {
		if (local == null)
			return false;
		else
			return (local.equals(v));

	} else if (v instanceof InstanceFieldRef) {
		InstanceFieldRef ifr = (InstanceFieldRef) v;
		if (local == null) {
			if (ifr.getBase() != null)
				return false;
		} else if (!local.equals(ifr.getBase()))
			return false;
		if (fields.length > 0 && ifr.getField() == fields[0])
			return true;
		return false;

	} else if (v instanceof StaticFieldRef) {
		StaticFieldRef sfr = (StaticFieldRef) v;
		if (local != null)
			return false;
		if (fields.length > 0 && sfr.getField() == fields[0])
			return true;
		return false;

	} else if (v instanceof ArrayRef) {
		ArrayRef ar = (ArrayRef) v;
		if (local == null)
			return false;
		else
			return (local.equals(ar.getBase()));

	} else if (v instanceof Constant) {
		return false;
	} else
		throw new RuntimeException("Unexpected left side " + v.getClass());
}
 
开发者ID:secure-software-engineering,项目名称:cheetah,代码行数:39,代码来源:FlowAbstraction.java

示例13: getPostfix

import soot.jimple.StaticFieldRef; //导入依赖的package包/类
public SootField[] getPostfix(Value v) { // this is longer than v
	if (v instanceof InstanceFieldRef || v instanceof StaticFieldRef) {
		if (fields.length > 0)
			return Arrays.copyOfRange(fields, 1, fields.length);
		return new SootField[] {};
	} else if (v instanceof ArrayRef) {
		return new SootField[] {};
	} else
		throw new RuntimeException("Unexpected left side " + v.getClass());
}
 
开发者ID:secure-software-engineering,项目名称:cheetah,代码行数:11,代码来源:FlowAbstraction.java

示例14: taintAliases

import soot.jimple.StaticFieldRef; //导入依赖的package包/类
/***** Aliases *****/

	private Set<FlowAbstraction> taintAliases(FlowAbstraction fa) {

		// System.out.println(icfg.getMethodOf(fa.getUnit()).getActiveBody());

		Set<FlowAbstraction> ret = new HashSet<FlowAbstraction>();

		// Should not consider other cases...
		if (fa.getLocal() != null) {
			Set<Value> mayAliases = icfg.mayAlias(fa.getLocal(), fa.getUnit());
			mayAliases.remove(fa.getLocal());

			for (Value alias : mayAliases) {
				if (alias instanceof Local || alias instanceof ArrayRef || alias instanceof StaticFieldRef
						|| alias instanceof InstanceFieldRef) {
					FlowAbstraction faT = getTaint(fa.getLocal(), alias, fa, fa.getUnit());
					if (faT != null)
						ret.add(faT);
				}
			}

			if (DEBUG_ALIAS) {
				if (!ret.isEmpty()) {
					LOGGER.debug("At " + fa.getUnit());
					LOGGER.debug("\tAliases of " + fa.getLocal() + " are: " + mayAliases);
					LOGGER.debug("\tAlias tainting " + ret);
				}
			}
		}
		return ret;
	}
 
开发者ID:secure-software-engineering,项目名称:cheetah,代码行数:33,代码来源:AnalysisTask.java

示例15: getTaint

import soot.jimple.StaticFieldRef; //导入依赖的package包/类
/***** Taints *****/

	private FlowAbstraction getTaint(Value right, Value left, FlowAbstraction source, Unit src) {
		FlowAbstraction fa = null;

		if (right instanceof CastExpr)
			right = ((CastExpr) right).getOp();

		if (right instanceof Local && source.getLocal() == right) {
			fa = FlowAbstraction.v(source.getSource(), left, src, icfg.getMethodOf(src), source);
			fa = fa.append(source.getFields());
		} else if (right instanceof InstanceFieldRef) {
			InstanceFieldRef ifr = (InstanceFieldRef) right;
			if (source.hasPrefix(ifr)) {
				fa = FlowAbstraction.v(source.getSource(), left, src, icfg.getMethodOf(src), source);
				fa = fa.append(source.getPostfix(ifr));
			}
		} else if (right instanceof StaticFieldRef) {
			StaticFieldRef sfr = (StaticFieldRef) right;
			if (source.hasPrefix(sfr)) {
				fa = FlowAbstraction.v(source.getSource(), left, src, icfg.getMethodOf(src), source);
				fa = fa.append(source.getPostfix(sfr));
			}
		} else if (right instanceof ArrayRef) {
			ArrayRef ar = (ArrayRef) right;
			if (ar.getBase() == source.getLocal())
				fa = FlowAbstraction.v(source.getSource(), left, src, icfg.getMethodOf(src), source);
		}
		return fa;
	}
 
开发者ID:secure-software-engineering,项目名称:cheetah,代码行数:31,代码来源:AnalysisTask.java


注:本文中的soot.jimple.StaticFieldRef类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。