Message9810

Author jmadden
Recipients jmadden
Date 2015-04-13.19:07:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1428952074.72.0.354496438103.issue2324@psf.upfronthosting.co.za>
In-reply-to
Content
This shows up in testing ZODB under Jython. ZODB creates a StringIO object and repeatedly uses it to pickle objects, resetting it each time. Given the write sequence of calls, this results in a StringIndexOutOfBoundsException.

>>> from cStringIO import StringIO
>>> before = 'cpersistent.mapping\nPersistentMapping\nq\x00.}q\x01U\x04dataq\x02}q\x03U\x04testq\x04(U\x08\x00\x00\x00\x00\x00\x00\x00\x01q\x05h\x00tq\x06Qss.'
>>> sio.write(before)
>>> sio.truncate()
>>> sio.seek(0)
strs = ['cpersistent.mapping\nPersistentMapping\n',
... 'q\x00',
... '.',
... '}',
... 'q\x01',
... 'U\x04data',
... 'q\x02',
... '}',
... 'q\x03',
... '(',
... 'K\x00',
... '(',
... 'U\x08\x00\x00\x00\x00\x00\x00\x00\x02',
... 'q\x04',
... 'h\x00',
... 't',
... 'q\x05',
... 'Q',
... 'K\x01',
... '(',
... 'U\x08\x00\x00\x00\x00\x00\x00\x00\x03']
>>> for i in strs:
...  sio.write(i)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
	at java.lang.AbstractStringBuilder.replace(AbstractStringBuilder.java:828)
	at java.lang.StringBuilder.replace(StringBuilder.java:262)
	at org.python.modules.cStringIO$StringIO.write(cStringIO.java:375)
	at sun.reflect.GeneratedMethodAccessor8.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)

java.lang.StringIndexOutOfBoundsException: java.lang.StringIndexOutOfBoundsException: start > end

The exception happens on the very last string in the list.
History
Date User Action Args
2015-04-13 19:07:54jmaddensetrecipients: + jmadden
2015-04-13 19:07:54jmaddensetmessageid: <1428952074.72.0.354496438103.issue2324@psf.upfronthosting.co.za>
2015-04-13 19:07:54jmaddenlinkissue2324 messages
2015-04-13 19:07:54jmaddencreate