Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Long string computation crashes Jython #112

Open
xiaxinmeng opened this issue Aug 2, 2021 · 1 comment
Open

Long string computation crashes Jython #112

xiaxinmeng opened this issue Aug 2, 2021 · 1 comment

Comments

@xiaxinmeng
Copy link

See the following example, "X" takes long computation and then it crashes Jython.

test.py

big = 1073741824
type("X" * big, (), {"__slots__": big})

Crash report:

(base) xxm@xxm-System-Product-Name:~/Desktop/IFuzzer/bugs/Jython$ jython 'test.py'
"my" variable $jythonHome masks earlier declaration in same scope at /usr/bin/jython line 15.
Traceback (most recent call last):
File "test.py", line 2, in
type("X" * big, (), {"slots": big})
java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Arrays.java:3332)
at java.lang.String.(String.java:166)
at org.python.core.PyString.repeat(PyString.java:685)
at org.python.core.PyString.str___mul__(PyString.java:698)
at org.python.core.PyString.mul(PyString.java:690)
at org.python.core.PyObject._basic_mul(PyObject.java:2229)
at org.python.core.PyObject._mul(PyObject.java:2215)
at org.python.pycode._pyx0.f$0(/home/xxm/Desktop/IFuzzer/bugs/Jython/17645.py:2)
at org.python.pycode._pyx0.call_function(/home/xxm/Desktop/IFuzzer/bugs/Jython/17645.py)
at org.python.core.PyTableCode.call(PyTableCode.java:165)
at org.python.core.PyCode.call(PyCode.java:18)
at org.python.core.Py.runCode(Py.java:1275)
at org.python.util.PythonInterpreter.execfile(PythonInterpreter.java:235)
at org.python.util.jython.run(jython.java:247)
at org.python.util.jython.main(jython.java:129)

java.lang.OutOfMemoryError: java.lang.OutOfMemoryError: Java heap space

The expected output:

OverflowError

System:

Ubuntu 16.04
Jython 2.5.3
OpenJDK 64-Bit Server VM (Private Build) on java1.8.0_292

@xiaxinmeng
Copy link
Author

Again, this case crashes Jython master (Jython 2.7.3a1-DEV) with the same OutOfMemoryError.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant