Skip to content

Commit c1f6cd9

Browse files
committed
Bugfix: properly handle primitive types in source/sink definition files + removed some useless output
1 parent 5941752 commit c1f6cd9

File tree

2 files changed

+7
-14
lines changed

2 files changed

+7
-14
lines changed

soot-infoflow-android/src/soot/jimple/infoflow/android/source/AccessPathBasedSourceSinkManager.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import soot.jimple.infoflow.sourcesSinks.manager.SinkInfo;
3232
import soot.jimple.infoflow.sourcesSinks.manager.SourceInfo;
3333
import soot.jimple.infoflow.util.SystemClassHandler;
34+
import soot.jimple.infoflow.util.TypeUtils;
3435

3536
/**
3637
* SourceSinkManager for Android applications. This class uses precise access
@@ -192,7 +193,7 @@ private AccessPath getAccessPathFromDef(Value baseVal, AccessPathTuple apt, Info
192193
SootField[] fields = new SootField[apt.getFields().length];
193194
for (int i = 0; i < fields.length; i++) {
194195
SootClass lastFieldClass = i == 0 ? baseClass : Scene.v().getSootClass(apt.getFieldTypes()[i - 1]);
195-
Type fieldType = RefType.v(apt.getFieldTypes()[i]);
196+
Type fieldType = TypeUtils.getTypeFromString(apt.getFieldTypes()[i]);
196197
String fieldName = apt.getFields()[i];
197198
SootField fld = lastFieldClass.getFieldUnsafe(fieldName, fieldType);
198199
if (fld == null) {

soot-infoflow-android/src/soot/jimple/infoflow/android/source/parsers/xml/XMLSourceSinkParser.java

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -417,9 +417,8 @@ public static XMLSourceSinkParser fromFile(String fileName) throws IOException {
417417

418418
public static XMLSourceSinkParser fromFile(String fileName, ICategoryFilter categoryFilter) throws IOException {
419419
logger.info(String.format("Loading sources and sinks from %s...", fileName));
420-
if (!verifyXML(getStream(fileName))) {
421-
throw new IOException("The XML-File isn't valid, schema validation failed.");
422-
}
420+
verifyXML(getStream(fileName));
421+
423422
InputStream inputStream = getStream(fileName);
424423
try {
425424
return fromStream(inputStream, categoryFilter);
@@ -541,36 +540,29 @@ private XMLSourceSinkParser(InputStream stream, ICategoryFilter categoryFilter)
541540
*
542541
* @param fileName
543542
* of the XML
544-
* @return true = valid XML false = invalid XML
545543
* @throws IOException
546544
*/
547-
private static boolean verifyXML(InputStream inp) throws IOException {
545+
private static void verifyXML(InputStream inp) throws IOException {
548546
SchemaFactory sf = SchemaFactory.newInstance(W3C_XML_SCHEMA);
549547

550548
// Read the schema
551549
StreamSource xsdFile = new StreamSource(ResourceUtils.getResourceStream(XSD_FILE_PATH));
552550

553551
StreamSource xmlFile = new StreamSource(inp);
554-
boolean validXML = false;
555552
try {
556553
Schema schema = sf.newSchema(xsdFile);
557554
Validator validator = schema.newValidator();
558555
try {
559556
validator.validate(xmlFile);
560-
validXML = true;
561557
} catch (IOException e) {
562-
e.printStackTrace();
563-
}
564-
if (!validXML) {
565-
new IOException("File isn't valid against the xsd");
558+
throw new IOException("File isn't valid against the xsd", e);
566559
}
567560
} catch (SAXException e) {
568-
e.printStackTrace();
561+
throw new IOException("File isn't valid against the xsd", e);
569562
} finally {
570563
xsdFile.getInputStream().close();
571564
xmlFile.getInputStream().close();
572565
}
573-
return validXML;
574566
}
575567

576568
@Override

0 commit comments

Comments
 (0)