Skip to content

[Bug]: java.lang.IndexOutOfBoundsException in PyObjectLookupAttr.readAttributeQuickly #971

@correctmost

Description

@correctmost

Describe the bug

GraalPy crashes when running this fuzzed code:

class C:
    pass

C()._

Operating system

Linux

CPU architecture

x86_64

GraalPy version

GraalPy 3.12.8 (Oracle GraalVM Native 25.0.3)

JDK version

No response

Context configuration

No response

Steps to reproduce

Snippet listed above

Expected behavior

No crash

Stack trace

array (length: 1) index (1) is out of bounds!
java.lang.IndexOutOfBoundsException: array (length: 1) index (1) is out of bounds!
	at org.graalvm.truffle/com.oracle.truffle.api.strings.InternalErrors.indexOutOfBounds(InternalErrors.java:56)
	at org.graalvm.truffle/com.oracle.truffle.api.strings.AbstractTruffleString.boundsCheckI(AbstractTruffleString.java:536)
	at org.graalvm.truffle/com.oracle.truffle.api.strings.AbstractTruffleString.boundsCheck(AbstractTruffleString.java:491)
	at org.graalvm.truffle/com.oracle.truffle.api.strings.TruffleString$CodePointAtIndexNode.readCodePoint(TruffleString.java:3612)
	at org.graalvm.truffle/com.oracle.truffle.api.strings.TruffleStringFactory$CodePointAtIndexNodeGen$Uncached.execute(TruffleStringFactory.java:2375)
	at org.graalvm.truffle/com.oracle.truffle.api.strings.TruffleString$CodePointAtIndexNode.execute(TruffleString.java:3560)
	at org.graalvm.py/com.oracle.graal.python.lib.PyObjectLookupAttr.readAttributeQuickly(PyObjectLookupAttr.java:325)
	at org.graalvm.py/com.oracle.graal.python.lib.PyObjectGetAttr.getDynamicAttr(PyObjectGetAttr.java:106)
	at org.graalvm.py/com.oracle.graal.python.lib.PyObjectGetAttrNodeGen$Uncached.execute(PyObjectGetAttrNodeGen.java:469)
	at org.graalvm.py/com.oracle.graal.python.lib.PyObjectGetAttr.executeCached(PyObjectGetAttr.java:77)
	at org.graalvm.py/com.oracle.graal.python.nodes.bytecode.PBytecodeRootNode.bytecodeLoadAttr(PBytecodeRootNode.java:4894)
	at org.graalvm.py/com.oracle.graal.python.nodes.bytecode.PBytecodeRootNode.bytecodeLoop(PBytecodeRootNode.java:1911)
	at org.graalvm.py/com.oracle.graal.python.nodes.bytecode.PBytecodeRootNode.executeUncached(PBytecodeRootNode.java:1262)
	at org.graalvm.py/com.oracle.graal.python.nodes.bytecode.PBytecodeRootNode.executeFromBci(PBytecodeRootNode.java:1246)
	at org.graalvm.py/com.oracle.graal.python.nodes.bytecode.PBytecodeRootNode.execute(PBytecodeRootNode.java:1092)
[...snip...]

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions