Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
Version 2.5
-
None
-
None
Description
TextSever.resize()
does not check if "newLen" is negative which can happen if requested size is more than ( Integer.MAX_VALUE / 2)
consider core java implementation AbstractStringBuilder:expandCapacity:
void expandCapacity(int minimumCapacity) {
int newCapacity = (value.length + 1) * 2;
if (newCapacity < 0)
else if (minimumCapacity > newCapacity)
{ newCapacity = minimumCapacity; } value = Arrays.copyOf(value, newCapacity);
}
Here is the exception stack trace:
Nov 18 16:09:31 localhost java.lang.NegativeArraySizeException
Nov 18 16:09:31 localhost at
org.apache.xmlbeans.impl.store.Saver$TextSaver.resize(Saver.java:1695)
Nov 18 16:09:31 localhost at
org.apache.xmlbeans.impl.store.Saver$TextSaver.preEmit(Saver.java:1300)
Nov 18 16:09:31 localhost at
org.apache.xmlbeans.impl.store.Saver$TextSaver.emit(Saver.java:1231)
Nov 18 16:09:31 localhost at
org.apache.xmlbeans.impl.store.Saver$TextSaver.emitAttrHelper(Saver.java:1027)
Nov 18 16:09:31 localhost at
org.apache.xmlbeans.impl.store.Saver$TextSaver.emitElement(Saver.java:966)
Nov 18 16:09:31 localhost at
org.apache.xmlbeans.impl.store.Saver.processElement(Saver.java:476)
Nov 18 16:09:31 localhost at
org.apache.xmlbeans.impl.store.Saver.process(Saver.java:307)
Nov 18 16:09:31 localhost at
org.apache.xmlbeans.impl.store.Saver$TextSaver.saveToString(Saver.java:1859)
Nov 18 16:09:31 localhost at
org.apache.xmlbeans.impl.store.Cursor._xmlText(Cursor.java:546)
Nov 18 16:09:31 localhost at
org.apache.xmlbeans.impl.store.Cursor.xmlText(Cursor.java:2436)
Nov 18 16:09:31 localhost at
org.apache.xmlbeans.impl.values.XmlObjectBase.xmlText(XmlObjectBase.java:1489)
Attachments
Issue Links
- is related to
-
XMLBEANS-643 add extra Saver implementation that can use temp files
- Open