Uploaded image for project: 'XMLBeans'
  1. XMLBeans
  2. XMLBEANS-209

Saver$TextSaver.replace method throws java.lang.ArrayIndexOutOfBoundsException

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • Version 2
    • Version 2.2.1
    • None
    • None
    • Java2 RE 1.4 and Java2 RE 5.0

    Description

      Stacktrace is as follows.
      java.lang.ArrayIndexOutOfBoundsException
      at java.lang.System.arraycopy(Native Method)
      at org.apache.xmlbeans.impl.store.Saver$TextSaver.replace(Saver.java:1438)
      at org.apache.xmlbeans.impl.store.Saver$TextSaver.entitizeContent(Saver.java:1269)
      (snip)

      I checked each variables.
      1438: System.arraycopy( _buf, i, _buf, i + dCch, _in - i ); // i:16358 _in:16381 dcCh:4 _buf.length:16384

      I think _buf has not enough size.
      So, I changed source as follows.
      1438: if (_buf.length < _in+dCch+_in-i) i = resize( dCch, i);
      1439: System.arraycopy( _buf, i, _buf, i + dCch, _in - i );

      This is not good patch, but I can save xml data.

      regards.

      Attachments

        1. saver.patch
          3 kB
          Wei Yin Teo

        Activity

          People

            Unassigned Unassigned
            hiro345 Koyama Hiroshi
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: