xml-xmlbeans-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eric Vasilik" <eric...@bea.com>
Subject RE: IndexArrayOutOfBoundsException in Saver.java (xmlbeans v1)
Date Fri, 13 Aug 2004 00:00:57 GMT
Can you give us a repro example?
 
-----Original Message-----
From: Brian Bartell [mailto:brianbartell@contentscan.com] 
Sent: Thursday, August 12, 2004 4:47 PM
To: xmlbeans-dev@xml.apache.org
Subject: IndexArrayOutOfBoundsException in Saver.java (xmlbeans v1)
 
Hello,
 
I found a bug in Saver.java.   It seems that some buffer
lengths are not adjusted when writing attribute
values that cross the buffer length boundary.
I get an IndexArrayOutOfBoundsException in
two different spots in the code.
 
The patch below seems to resolve the issue for me,
but I don't claim full confidence in it.  The patch is
against the latest xmlbeans v1 version from CVS, for
org.apache.xmlbeans.imple.store.Saver.java.
 
Cheers,
 
Brian
 
 
*** Saver-latest-xmlbeans.org.java 2004-08-12 16:30:05.000000000 -0700
--- Saver-mine.java 2004-08-12 16:37:33.000000000 -0700
***************
*** 1702,1707 ****
--- 1701,1708 ----
             if (_free < cch)
                 resize( cch, -1 );
             
+            if ( _buf!=null&&_in+cch>=_buf.length ) resize( cch, -1 );
+ 
             assert cch <= _free;
  
             int used = getAvailable();
***************
*** 2052,2057 ****
--- 2053,2060 ----
             else
             {
                 assert i < _in;
+                if ( _in + dCch > _buf.length )
+                  i = resize( _in + dCch - _buf.length, i ) ;
                 System.arraycopy( _buf, i, _buf, i + dCch, _in - i );
                 _in += dCch;
             }

Mime
View raw message