NegativeArraySizeException thrown from TextSaver.resize -------------------------------------------------------
Key: XMLBEANS-474 URL: https://issues.apache.org/jira/browse/XMLBEANS-474 Project: XMLBeans Issue Type: Bug Affects Versions: Version 2.5 Reporter: Dan Faershtein 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) { newCapacity = Integer.MAX_VALUE; } 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) -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@xmlbeans.apache.org For additional commands, e-mail: dev-h...@xmlbeans.apache.org