Skip to content
New issue

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

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

Already on GitHub? # to your account

Python frontend crashes with java.lang.StringIndexOutOfBoundsException #1775

Closed
oxisto opened this issue Oct 3, 2024 · 1 comment · Fixed by #1776
Closed

Python frontend crashes with java.lang.StringIndexOutOfBoundsException #1775

oxisto opened this issue Oct 3, 2024 · 1 comment · Fixed by #1776
Assignees
Labels

Comments

@oxisto
Copy link
Member

oxisto commented Oct 3, 2024

Stack trace

java.util.concurrent.ExecutionException: java.lang.StringIndexOutOfBoundsException: Range [47, 249) out of bounds for length 247
	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:612)
	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:653)
Caused by: java.lang.StringIndexOutOfBoundsException: Range [47, 249) out of bounds for length 247
	at java.base/jdk.internal.util.Preconditions$1.apply(Preconditions.java:55)
	at java.base/jdk.internal.util.Preconditions$1.apply(Preconditions.java:52)
	at java.base/jdk.internal.util.Preconditions$4.apply(Preconditions.java:213)
	at java.base/jdk.internal.util.Preconditions$4.apply(Preconditions.java:210)
	at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:98)
	at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckFromToIndex(Preconditions.java:112)
	at java.base/jdk.internal.util.Preconditions.checkFromToIndex(Preconditions.java:349)
	at java.base/java.lang.String.checkBoundsBeginEnd(String.java:4914)
	at java.base/java.lang.String.substring(String.java:2876)
	at de.fraunhofer.aisec.cpg.helpers.RegionUtilsKt.getCodeOfSubregion(RegionUtils.kt:72)
	at de.fraunhofer.aisec.cpg.graph.NodeBuilderKt.codeAndLocationFromChildren(NodeBuilder.kt:357)
	at de.fraunhofer.aisec.cpg.frontends.python.StatementHandler.makeBlock(StatementHandler.kt:781)
	at de.fraunhofer.aisec.cpg.frontends.python.StatementHandler.handleFunctionDef(StatementHandler.kt:531)
	at de.fraunhofer.aisec.cpg.frontends.python.StatementHandler.handleClassDef(StatementHandler.kt:436)
	at de.fraunhofer.aisec.cpg.frontends.python.StatementHandler.handleNode(StatementHandler.kt:59)
	at de.fraunhofer.aisec.cpg.frontends.python.StatementHandler.handleNode(StatementHandler.kt:54)
	at de.fraunhofer.aisec.cpg.frontends.python.PythonHandler.handle(PythonHandler.kt:43)
	at de.fraunhofer.aisec.cpg.frontends.python.PythonLanguageFrontend.pythonASTtoCPG(PythonLanguageFrontend.kt:270)
	at de.fraunhofer.aisec.cpg.frontends.python.PythonLanguageFrontend.parse(PythonLanguageFrontend.kt:79)
	at de.fraunhofer.aisec.cpg.TranslationManager.parse(TranslationManager.kt:387)
	at de.fraunhofer.aisec.cpg.TranslationManager.parseSequentially(TranslationManager.kt:340)
	at de.fraunhofer.aisec.cpg.TranslationManager.runFrontends(TranslationManager.kt:240)
	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:507)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1489)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:2071)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:2033)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:187)

Unexpected behavior

It crashes

Code of interest

http://github.com/blakeblackshear/frigate

@oxisto
Copy link
Member Author

oxisto commented Oct 3, 2024

Seems to be related to the non-unicode? characters in the file here

https://github.com/blakeblackshear/frigate/blob/dev/frigate/test/test_video.py#L85C9-L88

oxisto added a commit that referenced this issue Oct 3, 2024
oxisto added a commit that referenced this issue Oct 4, 2024
oxisto added a commit that referenced this issue Oct 4, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants