cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 15506] New: - ArrayIndexOutOfBoundsException (due to boundary condition)
Date Wed, 18 Dec 2002 21:02:30 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15506>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15506

ArrayIndexOutOfBoundsException (due to boundary condition)

           Summary: ArrayIndexOutOfBoundsException (due to boundary
                    condition)
           Product: Cocoon 2
           Version: Current CVS
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: core
        AssignedTo: cocoon-dev@xml.apache.org
        ReportedBy: ricktessner@canada.com


Very occasionally got an ArrayIndexOutOfBoundsException exception thrown by
org.apache.cocoon.util.BufferedOutputStream.write().

It is due to an off-by-one boundary condition and is easily fixed with the diff
below.

Index: src/java/org/apache/cocoon/util/BufferedOutputStream.java
===================================================================
RCS file:
/home/cvspublic/xml-cocoon2/src/java/org/apache/cocoon/util/BufferedOutputStream.java,v
retrieving revision 1.2
diff -u -r1.2 BufferedOutputStream.java
--- src/java/org/apache/cocoon/util/BufferedOutputStream.java	8 Nov 2002
11:09:39 -0000	1.2
+++ src/java/org/apache/cocoon/util/BufferedOutputStream.java	18 Dec 2002
21:00:46 -0000
@@ -127,7 +127,7 @@
      * @exception  IOException  if an I/O error occurs.
      */
     public void write(byte b[], int off, int len) throws IOException {
-        while (len > buf.length - count) {
+        while (len >= buf.length - count) {
             this.incBuffer();
         }
         System.arraycopy(b, off, buf, count, len);

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Mime
View raw message