You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
java.util.concurrent.ExecutionException: java.lang.ClassCastException: class de.fraunhofer.aisec.cpg.graph.statements.expressions.InitializerListExpression cannot be cast to class de.fraunhofer.aisec.cpg.graph.statements.expressions.ConstructExpression (de.fraunhofer.aisec.cpg.graph.statements.expressions.InitializerListExpression and de.fraunhofer.aisec.cpg.graph.statements.expressions.ConstructExpression are in unnamed module of loader 'app')
at java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:396)
at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2073)
at de.fraunhofer.aisec.cpg_vis_neo4j.Application.call(Application.kt:614)
at de.fraunhofer.aisec.cpg_vis_neo4j.Application.call(Application.kt:88)
at picocli.CommandLine.executeUserObject(CommandLine.java:2041)
at picocli.CommandLine.access$1500(CommandLine.java:148)
at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2461)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2453)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2415)
at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2273)
at picocli.CommandLine$RunLast.execute(CommandLine.java:2417)
at picocli.CommandLine.execute(CommandLine.java:2170)
at de.fraunhofer.aisec.cpg_vis_neo4j.ApplicationKt.main(Application.kt:655)
Caused by: java.lang.ClassCastException: class de.fraunhofer.aisec.cpg.graph.statements.expressions.InitializerListExpression cannot be cast to class de.fraunhofer.aisec.cpg.graph.statements.expressions.ConstructExpression (de.fraunhofer.aisec.cpg.graph.statements.expressions.InitializerListExpression and de.fraunhofer.aisec.cpg.graph.statements.expressions.ConstructExpression are in unnamed module of loader 'app')
at de.fraunhofer.aisec.cpg.frontends.cxx.ExpressionHandler.handleNewExpression(ExpressionHandler.kt:266)
at de.fraunhofer.aisec.cpg.frontends.cxx.ExpressionHandler.handleNode(ExpressionHandler.kt:81)
at de.fraunhofer.aisec.cpg.frontends.cxx.ExpressionHandler.handleNode(ExpressionHandler.kt:61)
at de.fraunhofer.aisec.cpg.frontends.cxx.CXXHandler.handle(CXXHandler.kt:58)
at de.fraunhofer.aisec.cpg.frontends.cxx.InitializerHandler.handleEqualsInitializer(InitializerHandler.kt:93)
at de.fraunhofer.aisec.cpg.frontends.cxx.InitializerHandler.handleNode(InitializerHandler.kt:48)
at de.fraunhofer.aisec.cpg.frontends.cxx.InitializerHandler.handleNode(InitializerHandler.kt:43)
at de.fraunhofer.aisec.cpg.frontends.cxx.CXXHandler.handle(CXXHandler.kt:58)
at de.fraunhofer.aisec.cpg.frontends.cxx.DeclarationHandler.handleSimpleDeclaration(DeclarationHandler.kt:493)
at de.fraunhofer.aisec.cpg.frontends.cxx.DeclarationHandler.handleNode(DeclarationHandler.kt:67)
at de.fraunhofer.aisec.cpg.frontends.cxx.DeclarationHandler.handleNode(DeclarationHandler.kt:62)
at de.fraunhofer.aisec.cpg.frontends.cxx.CXXHandler.handle(CXXHandler.kt:58)
at de.fraunhofer.aisec.cpg.frontends.cxx.StatementHandler.handleDeclarationStatement(StatementHandler.kt:302)
at de.fraunhofer.aisec.cpg.frontends.cxx.StatementHandler.handleNode(StatementHandler.kt:53)
at de.fraunhofer.aisec.cpg.frontends.cxx.StatementHandler.handleNode(StatementHandler.kt:46)
at de.fraunhofer.aisec.cpg.frontends.cxx.CXXHandler.handle(CXXHandler.kt:58)
at de.fraunhofer.aisec.cpg.frontends.cxx.StatementHandler.handleCompoundStatement(StatementHandler.kt:329)
at de.fraunhofer.aisec.cpg.frontends.cxx.StatementHandler.handleNode(StatementHandler.kt:51)
at de.fraunhofer.aisec.cpg.frontends.cxx.StatementHandler.handleNode(StatementHandler.kt:46)
at de.fraunhofer.aisec.cpg.frontends.cxx.CXXHandler.handle(CXXHandler.kt:58)
at de.fraunhofer.aisec.cpg.frontends.cxx.DeclarationHandler.handleFunctionDefinition(DeclarationHandler.kt:207)
at de.fraunhofer.aisec.cpg.frontends.cxx.DeclarationHandler.handleNode(DeclarationHandler.kt:68)
at de.fraunhofer.aisec.cpg.frontends.cxx.DeclarationHandler.handleNode(DeclarationHandler.kt:62)
at de.fraunhofer.aisec.cpg.frontends.cxx.CXXHandler.handle(CXXHandler.kt:58)
at de.fraunhofer.aisec.cpg.frontends.cxx.DeclarationHandler.handleTranslationUnit(DeclarationHandler.kt:732)
at de.fraunhofer.aisec.cpg.frontends.cxx.CXXLanguageFrontend.parse(CXXLanguageFrontend.kt:270)
at de.fraunhofer.aisec.cpg.TranslationManager.parse(TranslationManager.kt:397)
at de.fraunhofer.aisec.cpg.TranslationManager.parseSequentially(TranslationManager.kt:350)
at de.fraunhofer.aisec.cpg.TranslationManager.runFrontends(TranslationManager.kt:250)
at de.fraunhofer.aisec.cpg.TranslationManager.analyzeNonAsync(TranslationManager.kt:88)
at de.fraunhofer.aisec.cpg.TranslationManager.analyze$lambda$0(TranslationManager.kt:70)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1760)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
Unexpected behavior
When handling the new expression of a template class, the InitializerListExpression is casted to an ConstructExpression, which is not possible, as both classes are siblings.
When I'm thinking about this, I'm wondering why this error is not spotted by the linter?
Code of interest
poc:
template <typename T>
structA
{
int i;
};
intmain() {
A<int> a{1}; // OK
A<int> *p = new A<int>{1}; // Failreturn0;
}
Stack trace
Unexpected behavior
When handling the
new
expression of a template class, theInitializerListExpression
is casted to anConstructExpression
, which is not possible, as both classes are siblings.When I'm thinking about this, I'm wondering why this error is not spotted by the linter?
Code of interest
poc:
ExpressionHandler
:cpg/cpg-language-cxx/src/main/kotlin/de/fraunhofer/aisec/cpg/frontends/cxx/ExpressionHandler.kt
Lines 261 to 268 in db340a1
Extensions to the library, e.g. added or changed LanguageFrontends or Passes
No
Changes to the configuration
No
The text was updated successfully, but these errors were encountered: