<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "/bugzilla/bugzilla.dtd">

<bugzilla version="2.22.1-debian2"
          urlbase="http://www.jacorb.org/cgi-bin/bugzilla/"
          maintainer="spiegel@gnu.org"
>

    <bug>
          <bug_id>230</bug_id>
          
          <creation_ts>2002-07-19 15:47</creation_ts>
          <short_desc>Marshalling, CDROutputStream, write behind buffer</short_desc>
          <delta_ts>2002-08-06 12:22:12</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>JacORB</product>
          <component>ORB</component>
          <version>1.4 beta 4</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows 2000</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          
          <priority>P2</priority>
          <bug_severity>blocker</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>jaeger@varial.de</reporter>
          <assigned_to>gerald.brose@acm.org</assigned_to>
          

      

      
          <long_desc isprivate="0">
            <who>jaeger@varial.de</who>
            <bug_when>2002-07-19 15:47:30</bug_when>
            <thetext>Jacorb produces the following exception in some cases which are actually hard to
reproduce and have been only discovered by chance. 
Obviously something is wrong with the buffer size/position/index in the method
check ...
Only when a certain amount of data is transferred this happens; since I don&apos;t
know the Jacorb internals it is impossible for me to produce a simple example.

############################ StackTrace ############################
java.lang.ArrayIndexOutOfBoundsException
        at org.jacorb.orb.CDROutputStream.check(CDROutputStream.java:337)
        at org.jacorb.orb.CDROutputStream.write_short(CDROutputStream.java:1105)
        at
com.varial.accounting.invoiceallocation.InvoiceAllocationOpenItemStructHelper.write(InvoiceAllocationOpenItemStructHelper.java:75)
        at
com.varial.accounting.invoiceallocation.InvoiceAllocationOpenItemSeqHelper.write(InvoiceAllocationOpenItemSeqHelper.java:47)
        at
com.varial.accounting.invoiceallocation.InvoiceAllocationServantPOA._invoke(InvoiceAllocationServantPOA.java:439)
        at
org.jacorb.poa.RequestProcessor.invokeOperation(RequestProcessor.java:239)
        at org.jacorb.poa.RequestProcessor.process(RequestProcessor.java:456)
        at org.jacorb.poa.RequestProcessor.run(RequestProcessor.java:581)</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>jaeger@varial.de</who>
            <bug_when>2002-08-06 11:46:51</bug_when>
            <thetext>Please find a patch below:

*** CDROutputStream.java.org	Mon Jul 29 07:33:16 2002
--- CDROutputStream.java	Tue Aug  6 09:18:01 2002
***************
*** 341,355 ****
              
              //at maximum, there are 8 bytes of padding. the following
              //is (supposed to be :-) faster than using a for-loop
!             buffer[ pos     ] = (byte) 0;
!             buffer[ pos + 1 ] = (byte) 0;
!             buffer[ pos + 2 ] = (byte) 0;
!             buffer[ pos + 3 ] = (byte) 0;
!             buffer[ pos + 4 ] = (byte) 0;
!             buffer[ pos + 5 ] = (byte) 0;
!             buffer[ pos + 6 ] = (byte) 0;
!             buffer[ pos + 7 ] = (byte) 0;
!             
              index += remainder;
              pos += remainder;
          }
--- 341,354 ----
              
              //at maximum, there are 8 bytes of padding. the following
              //is (supposed to be :-) faster than using a for-loop
! 
!             // but check does not check for 8 bytes ...
!             int topad = Math.min(buffer.length - pos, 8);
!             for (int j = 0; j &lt; topad; j++)
!             {
!                 buffer[ pos + j ] = (byte) 0;
!             }
! 
              index += remainder;
              pos += remainder;
          }
</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>steve@prismtechnologies.com</who>
            <bug_when>2002-08-06 12:22:12</bug_when>
            <thetext>Thnaks for the fix Uwe.</thetext>
          </long_desc>
      
    </bug>

</bugzilla>