[Bug]: NullPointerException in PythonLocaleData.getLocaleData
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 70/100
Research direction
Reproduce the crash with the supplied re.search('A', '', 9999) snippet, then inspect PythonLocaleData.java at line 81 and the regex entry points named in the stack trace. Add regression coverage for this input and verify that it completes without a NullPointerException.
Written by the indexing model from the issue text.
Description
Describe the bug
GraalPy crashes when running this fuzzed code:
import re
re.search('A', '', 9999)
Operating system
Linux
CPU architecture
x86_64
GraalPy version
GraalPy 3.13.14 (Oracle GraalVM Native 25.3.4.1)
JDK version
No response
Context configuration
No response
Steps to reproduce
Snippet listed above
Expected behavior
No crash
Stack trace
java.lang.NullPointerException: Stack trace is imprecise, the top frames are missing and/or have wrong line numbers. To get precise stack traces, build the image with option -H:-ReduceImplicitExceptionStackTraceInformation
at com.oracle.truffle.regex/com.oracle.truffle.regex.flavor.python.PythonLocaleData.getLocaleData(PythonLocaleData.java:81)
at com.oracle.truffle.regex/com.oracle.truffle.regex.flavor.python.PythonRegexLexer.getLocaleData(PythonRegexLexer.java:198)
at com.oracle.truffle.regex/com.oracle.truffle.regex.flavor.python.PythonRegexLexer.caseFoldUnfold(PythonRegexLexer.java:348)
at com.oracle.truffle.regex/com.oracle.truffle.regex.flavor.python.PythonRegexParser.literalChar(PythonRegexParser.java:315)
at com.oracle.truffle.regex/com.oracle.truffle.regex.flavor.python.PythonRegexParser.parse(PythonRegexParser.java:244)
at com.oracle.truffle.regex/com.oracle.truffle.regex.tregex.TRegexCompilationRequest.parse(TRegexCompilationRequest.java:349)
at com.oracle.truffle.regex/com.oracle.truffle.regex.tregex.TRegexCompilationRequest.compileInternal(TRegexCompilationRequest.java:159)
at com.oracle.truffle.regex/com.oracle.truffle.regex.tregex.TRegexCompilationRequest.compile(TRegexCompilationRequest.java:143)
at com.oracle.truffle.regex/com.oracle.truffle.regex.tregex.TRegexCompiler.doCompile(TRegexCompiler.java:89)
at com.oracle.truffle.regex/com.oracle.truffle.regex.tregex.TRegexCompiler.compile(TRegexCompiler.java:75)
at com.oracle.truffle.regex/com.oracle.truffle.regex.RegexLanguage.createRegexObject(RegexLanguage.java:205)
at com.oracle.truffle.regex/com.oracle.truffle.regex.RegexLanguage.parse(RegexLanguage.java:164)
at org.graalvm.truffle/com.oracle.truffle.api.TruffleLanguage$ParsingRequest.parse(TruffleLanguage.java:1204)
at org.graalvm.truffle/com.oracle.truffle.api.TruffleLanguage.parse(TruffleLanguage.java:1618)
at org.graalvm.truffle/com.oracle.truffle.api.LanguageAccessor$LanguageImpl.parse(LanguageAccessor.java:309)
at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotSourceCache.parseImpl(PolyglotSourceCache.java:114)
at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotSourceCache$WeakCache.lookup(PolyglotSourceCache.java:351)
at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotSourceCache.parseCached(PolyglotSourceCache.java:94)
at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotLanguageContext.parseCached(PolyglotLanguageContext.java:377)
at org.graalvm.truffle/com.oracle.truffle.polyglot.EngineAccessor$EngineImpl.parseForLanguage(EngineAccessor.java:332)
at org.graalvm.truffle/com.oracle.truffle.api.TruffleLanguage$Env.parseInternal(TruffleLanguage.java:2648)
at org.graalvm.py/com.oracle.graal.python.builtins.modules.re.TRegexCache.compile(TRegexCache.java:307)
at org.graalvm.py/com.oracle.graal.python.builtins.modules.re.PatternNodes$TRegexCompileNode.getCompiledRegexLocaleNonSensitive(PatternNodes.java:220)
at org.graalvm.py/com.oracle.graal.python.builtins.modules.re.PatternNodes$TRegexCompileNode.localeNonSensitive(PatternNodes.java:228)
at org.graalvm.py/com.oracle.graal.python.builtins.modules.re.PatternNodesFactory$TRegexCompileNodeGen.executeAndSpecialize(PatternNodesFactory.java:841)
at org.graalvm.py/com.oracle.graal.python.builtins.modules.re.PatternNodesFactory$TRegexCompileNodeGen.execute(PatternNodesFactory.java:752)
at org.graalvm.py/com.oracle.graal.python.builtins.modules.re.PatternBuiltins$NewNode.newPattern(PatternBuiltins.java:188)
at org.graalvm.py/com.oracle.graal.python.builtins.modules.re.PatternBuiltinsFactory$NewNodeFactory$NewNodeGen.execute(PatternBuiltinsFactory.java:248)
at org.graalvm.py/com.oracle.graal.python.nodes.function.builtins.BuiltinCallNode$BuiltinAnyCallNode.execute(BuiltinCallNode.java:64)
at org.graalvm.py/com.oracle.graal.python.nodes.function.BuiltinFunctionRootNode.execute(BuiltinFunctionRootNode.java:337)
[...snip...]
Additional context
No response
- Dominant language
- Python
- Stars
- 1.6k
- Forks
- 155
- Avg merge
- 8h 20m
- Merged PRs (30d)
- 43
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from oracle/graalpython
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
oracle/graalpython#1105 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
oracle/graalpython#1102 ·
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 74/100
oracle/graalpython#1133 ·
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 68/100
oracle/graalpython#1112 ·
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 68/100
oracle/graalpython#1111 ·
All issues in oracle/graalpython
Similar issues
-
area: harness bug status: needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Human-Agent-Society/reef#625 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 1/5 Under an hour Newbie friendliness 80/100
learningequality/kolibri#15351 · 2 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Name consistency Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
eellak/triplestore#65 · 1 comment ·