[omniORB] Bug in cdrMemoryStream ?

Serguei Kolos Serguei.Kolos at cern.ch
Fri Oct 24 19:20:15 BST 2008


Hi

I'm using cdrMemoryStream class of the omniORB to do some data 
packing/unpacking.
After moving to the omniORB 4.1.3 I got my application crashing because 
of the negative
value returned by the cdrMemoryStream::bufSize() function when I'm using 
memory stream
for reading from the input buffer. Looking to the code I have noticed a 
difference with respect
to the 4.0.7. Before bufSize was implemented like (file cdrMemoryStream.cc):

    CORBA::ULong
    cdrMemoryStream::bufSize() const
    {
      if (!pd_readonly_and_external_buffer) {
        return (CORBA::ULong)((omni::ptr_arith_t)pd_outb_mkr -
                  (omni::ptr_arith_t)ensure_align_8(pd_bufp));
      }
      else {
        return (CORBA::ULong)((omni::ptr_arith_t)pd_inb_end -
                  (omni::ptr_arith_t)pd_bufp);
      }
    }

And in 4.1.3 it is:

    CORBA::ULong
    cdrMemoryStream::bufSize() const
    {
      return (CORBA::ULong)((omni::ptr_arith_t)pd_outb_mkr -
                (omni::ptr_arith_t)pd_bufp_8);
    }

In case of using this object for input the pd_outb_mkr=0 and pd_bufp_8
is pointing to the beginning of the buffer, so the result is a large 
negative
number. Is that a bug or I'm missing something?

Cheers,
Sergei




More information about the omniORB-list mailing list