github / github/codeql

ArrayIndexOutOfBoundsException in com.semmle.inmemory.pipeline.MetaPipelineInstance.wrapWithRaDump(MetaPipelineInstance.java:204)

Open
#19,197 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
CodeQL
Stars
10.1k
Forks
2.1k
Avg merge
2d 15h
Merged PRs (30d)
141

Description

java.lang.ArrayIndexOutOfBoundsException: Index 228617 out of bounds for length 202748
The RA to evaluate was:

{2} r1 = SCAN `SsaInternalsCommon::isUse/5#651d70a4` OUTPUT In.2, In.4
return r1

(eventual cause: ArrayIndexOutOfBoundsException "Index 228617 out of bounds for length 202748")
at com.semmle.inmemory.pipeline.MetaPipelineInstance.wrapWithRaDump(MetaPipelineInstance.java:204)
at com.semmle.inmemory.pipeline.MetaPipelineInstance.exceptionCaught(MetaPipelineInstance.java:174)
at com.semmle.inmemory.scheduler.execution.ThreadableWork.handleAndLog(ThreadableWork.java:593)
at com.semmle.inmemory.scheduler.execution.ThreadableWork.doSomeWork(ThreadableWork.java:410)
at com.semmle.inmemory.scheduler.IntensionalLayer$IntensionalWork.evaluate(IntensionalLayer.java:124)
at com.semmle.inmemory.scheduler.SimpleLayerTask$SimpleLayerWork.doWork(SimpleLayerTask.java:69)
at com.semmle.inmemory.scheduler.execution.ThreadableWork.doSomeWork(ThreadableWork.java:396)
at com.semmle.inmemory.scheduler.execution.ExecutionScheduler.runnerMain(ExecutionScheduler.java:707)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 228617 out of bounds for length 202748
at com.semmle.inmemory.relations.IntArraySorter.bsearchRange(IntArraySorter.java:689)
at com.semmle.inmemory.relations.IntArraySorter.bsearch(IntArraySorter.java:683)
at com.semmle.inmemory.relations.IntArraySorter.growRun(IntArraySorter.java:445)
at com.semmle.inmemory.relations.IntArraySorter.updateStack(IntArraySorter.java:299)
at com.semmle.inmemory.relations.IntArraySorter.sortAndDeliverCompletePages(IntArraySorter.java:141)
at com.semmle.inmemory.relations.writers.IntArrayWriter.sortAndDeliverCompletePages(IntArrayWriter.java:277)
at com.semmle.inmemory.relations.writers.UnsortedRelationWriter.makeSpaceIfNeeded(UnsortedRelationWriter.java:133)
at com.semmle.inmemory.relations.writers.UnsortedRelationWriter$1.addBatch(UnsortedRelationWriter.java:115)
at com.semmle.inmemory.pipeline.RelationWritingStep$RelationWritingState.processBatch(RelationWritingStep.java:90)
at com.semmle.inmemory.pipeline.SimpleStep$SimpleState.deliverBatch(SimpleStep.java:146)
at com.semmle.inmemory.pipeline.SimpleStep$SimpleState.deliverOwnBatch(SimpleStep.java:130)
at com.semmle.inmemory.pipeline.ExpanderStep$ExpanderState.deliverMatchOutput(ExpanderStep.java:85)
at com.semmle.inmemory.pipeline.LiteralStep$LiteralState.deliverRelation(LiteralStep.java:76)
at com.semmle.inmemory.pipeline.LiteralStep.deliverRelation(LiteralStep.java:161)
at com.semmle.inmemory.pipeline.LiteralStep$1.headEndWork(LiteralStep.java:141)
at com.semmle.inmemory.pipeline.HeadEndDispatcher.headEndWork(HeadEndDispatcher.java:75)
at com.semmle.inmemory.pipeline.PipelineState.doSomeWork(PipelineState.java:88)
at com.semmle.inmemory.pipeline.PipelineInstance.doWork(PipelineInstance.java:78)
at com.semmle.inmemory.scheduler.execution.ThreadableWork.doSomeWork(ThreadableWork.java:396)
at com.semmle.inmemory.scheduler.execution.ChainingWork.doWork(ChainingWork.java:30)
at com.semmle.inmemory.scheduler.execution.ThreadableWork.doSomeWork(ThreadableWork.java:396)
... 7 more

Contributor guide

Open the contributing guide

Research direction

Start with MetaPipelineInstance.java at lines 204 and 174, then inspect IntArraySorter.java around lines 689, 683, 445, 299, and 141. Reproduce the reported RA evaluation for SsaInternalsCommon::isUse/5#651d70a4 and trace how the index exceeds the relation length. Done means the evaluation no longer raises ArrayIndexOutOfBoundsException, with coverage for the failure case.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.