Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CFG analysis with exceptions:null will cause NPE #133

Closed
cs-cat opened this issue Dec 14, 2024 · 1 comment · Fixed by #134
Closed

CFG analysis with exceptions:null will cause NPE #133

cs-cat opened this issue Dec 14, 2024 · 1 comment · Fixed by #134
Labels
type: bug A general bug

Comments

@cs-cat
Copy link
Contributor

cs-cat commented Dec 14, 2024

📝 Overall Description

CFG analysis with exceptions:null will cause NPE.
root cause: satisfyConditions in Configs.java does not handle null values for options.

// then this condition can be satisfied.
for (String v : value.split("\\|")) {
if (options.get(key).toString().equals(v)) {
continue outer;
}

🎯 Expected Behavior

finish CFG analysis

🐛 Current Behavior

Exception in thread "main" java.lang.NullPointerException: Cannot invoke "Object.toString()" because the return value of "pascal.taie.config.AnalysisOptions.get(String)" is null
	at pascal.taie.config.Configs.satisfyConditions(Configs.java:98)
	at pascal.taie.config.ConfigManager.lambda$getRequiredConfigs$1(ConfigManager.java:101)
	at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:196)
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1709)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:570)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:560)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:636)
	at java.base/java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:291)
	at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:656)
	at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:662)
	at java.base/java.util.stream.ReferencePipeline.toList(ReferencePipeline.java:667)
	at pascal.taie.config.ConfigManager.lambda$getRequiredConfigs$3(ConfigManager.java:104)
	at java.base/java.util.HashMap.computeIfAbsent(HashMap.java:1229)
	at pascal.taie.config.ConfigManager.getRequiredConfigs(ConfigManager.java:96)
	at pascal.taie.config.AnalysisPlanner.buildDependenceGraph(AnalysisPlanner.java:229)
	at pascal.taie.config.AnalysisPlanner.expandPlan(AnalysisPlanner.java:163)
	at pascal.taie.Main.processConfigs(Main.java:91)
	at pascal.taie.Main.lambda$main$0(Main.java:56)

🔄 Reproducible Example

analyses:
    cfg: dump:false;exception:null

⚙️ Tai-e Arguments

🔍 Click here to see Tai-e Options
{{The content of 'output/options.yml' file}}
🔍 Click here to see Tai-e Analysis Plan
{{The content of 'output/tai-e-plan.yml' file}}

📜 Tai-e Log

🔍 Click here to see Tai-e Log
{{The content of 'output/tai-e.log' file}}

ℹ️ Additional Information

reproduced in 9eb966e (v0.5.1)

@cs-cat cs-cat added the type: bug A general bug label Dec 14, 2024
cs-cat added a commit to cs-cat/Tai-e that referenced this issue Dec 14, 2024
…b#133)

Signed-off-by: cs-cat <118669451+cs-cat@users.noreply.github.com>
@zhangt2333
Copy link
Member

Thank you~

I have left a comment on your PR—please take a look.


Besises,

for an issue, a reproducible example should ideally consist of either a complete Java code snippet or a Tai-e Options file, rather than a partial analysis configuration. For instance:

public class Issue133 {
    public static void main(String[] args) {
        pascal.taie.Main.main(
                "-pp",
                "-cp", "src/test/resources/controlflow",
                "-m", "Exceptions",
                "-a", "cfg=dump:true;exception:null;"
        );
    }
}

or

optionsFile: null
printHelp: false
classPath:
- src/test/resources/controlflow
appClassPath: []
mainClass: Exceptions
inputClasses: []
javaVersion: 17
prependJVM: true
allowPhantom: false
worldBuilderClass: pascal.taie.frontend.soot.SootWorldBuilder
outputDir: output
preBuildIR: false
worldCacheMode: false
scope: APP
nativeModel: true
planFile: null
analyses:
  cfg: dump:true;exception:null;
onlyGenPlan: false
keepResult:
- $KEEP-ALL

cs-cat added a commit to cs-cat/Tai-e that referenced this issue Dec 15, 2024
…b#133)

Signed-off-by: cs-cat <118669451+cs-cat@users.noreply.github.com>
zhangt2333 pushed a commit that referenced this issue Dec 15, 2024
fix #133

Signed-off-by: cs-cat <118669451+cs-cat@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants