From: Jeff A. <re...@bu...> - 2019-08-27 22:58:42
|
New submission from Jeff Allen <ja...@fa...>: I noticed this failure in test_bytes, running with 2.7.2a1 standalone JAR: ====================================================================== ERROR: test_repeat (__main__.ByteArrayTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\Users\Jeff\Documents\Jython\272b-trial\Lib\test\test_bytes.py", line 233, in test_repeat lambda: b * sys.maxsize) File "C:\Users\Jeff\Documents\Jython\272b-trial\kit\jython-standalone.jar\Lib\unittest\case.py", line 476, in assertRaises callableObj(*args, **kwargs) File "C:\Users\Jeff\Documents\Jython\272b-trial\Lib\test\test_bytes.py", line 233, in <lambda> lambda: b * sys.maxsize) ArrayIndexOutOfBoundsException: java.lang.ArrayIndexOutOfBoundsException: arraycopy: last destination index 2147483646 out of bounds for byte[2147483645] ---------------------------------------------------------------------- Note that the apparent array size 2147483645 is the result of b*sys.maxsize, where len(b) is 3, and a lossy long to int conversion, taking place in org.python.core.BaseBytes.repeatImpl(int). We should be comparing first with sys.maxsize. In our tests this is usually masked by a MemoryError, but for some reason not in standalone. Also look elsewhere in BaseBytes and PyByteArray for other places we allocate an array without checking the size. ---------- components: Core keywords: test failure causes messages: 12642 nosy: jeff.allen priority: normal severity: normal status: open title: Request for oversize arrays not handled in BaseBytes and PyByteArray type: crash versions: Jython 2.7 _______________________________________ Jython tracker <re...@bu...> <https://bugs.jython.org/issue2796> _______________________________________ |