/* * Resolve Symbol... Bottom-Up navegation * This method occur after all symbols of one assign/call function instruction * are inserted in scope. After that, one by one is analyse (taint/untaint) */ public void resolveSymbol( Scope scp, Symbol sy, TaintedTable mts, UntaintedTable mus, String file) { Boolean b = scp.resolve(sy, mts, mus); Symbol sym = scp.getScopeSymbol(); // if symbol is tainted, then insert the symbol scope in the main TaintedTable, if it don't // exist yet // if don't, then verify if it pass to taint to untaint, and insert in main UntaintedTable if (b == true) { sy.setTainted(1); if (mts.getTaintedMembers().containsKey(sym.getName()) == false) { // verify if the tainted symbol exist in mts TaintedTable RootTaintedSymbol Rrt = new RootTaintedSymbol( sym.getName(), sym.getCodeLine(), sym.getTainted(), sym.getAlfanumeric(), sym.getFileSymbol()); mts.define(Rrt); // insert in mts TaintedTable } else { RootTaintedSymbol Rrt = (RootTaintedSymbol) mts.getTaintedMembers().get(sym.getName()); if (Rrt.getLinesList().contains(sym.getCodeLine()) == false || (Rrt.getLinesList().contains(sym.getCodeLine()) == true && Rrt.getFilesList().contains(sym.getFileSymbol()) == false)) { Rrt.setLineCode(sym.getCodeLine()); Rrt.setFile(sym.getFileSymbol()); RelatedTaintedSymbol rtt = new RelatedTaintedSymbol(sym.getCodeLine(), sym.getFileSymbol()); Rrt.define(rtt); } } if (mus.existSymbol(sym.getName()) == true) // verify if symbol pass to untaint to taint mus.removeUntaintSymbol(sym); } else { // verify if symbol pertence to mts and not to mus, then pass to taint to untaint if (mts.getTaintedMembers().containsKey(sym.getName()) == true && mus.existSymbol(sym.getName()) == false) { RootTaintedSymbol Rrt = (RootTaintedSymbol) mts.getTaintedMembers().get(sym.getName()); if (Rrt.getLinesList().contains(sy.getCodeLine()) == false) mus.insertUntaintSymbol(sym); } } }