[omniORB] Re: 4.0.X and 4.1.X Alignment bug when parsing GIOP 1.2 Reply when using service contexts

Jonathan Biggar jon at levanta.com
Tue Dec 11 10:57:57 GMT 2007


Jonathan Biggar wrote:
> GIOP 1.2 requires the REPLY body to be aligned on an 8 byte boundary. 
> omniORB has the code to do this alignment for normal replies and system 
> exceptions, but is missing the alignment call for user exceptions and 
> location forward replies.
> 
> This bug only manifests itself if service contexts are used to transmit 
> additional data from the CORBA server back to the client, and then only 
> if the service context length doesn't leave the alignment on an 8 byte 
> boundary already.
> 
> This bug appears in omniORB 4.0.X and 4.1.[01].
> 
> Here is a patch relative to omniORB 4.0.5 for the functions 
> giopImpl12::sendUserException and giopImpl12::sendLocationForwardReply:

This patch was incomplete.  There's a couple of other places that 
alignOuput() needed to be called.  Here's the complete patch:

--- giopImpl12.cc.orig  2007-12-10 16:29:23.000000000 -0800
+++ giopImpl12.cc       2007-12-11 08:50:54.000000000 -0800
@@ -1686,6 +1686,8 @@
      operator>>= ((CORBA::ULong)0,cs);
      operator>>= ((CORBA::ULong)0,cs);
      giop_s.service_contexts() >>= cs;
+    cs.alignOutput(omni::ALIGN_8);
+
      CORBA::ULong(repoid_size) >>= cs;
      cs.put_octet_array((const CORBA::Octet*) repoid, repoid_size);
      ex._NP_marshal(cs);
@@ -1704,6 +1706,8 @@
    // Service context
    giop_s.service_contexts() >>= s;

+  s.alignOutput(omni::ALIGN_8);
+
    // RepoId
    CORBA::ULong(repoid_size) >>= s;
    s.put_octet_array((const CORBA::Octet*) repoid, repoid_size);
@@ -1735,6 +1739,8 @@
      operator>>= ((CORBA::ULong)0,cs);
      operator>>= ((CORBA::ULong)0,cs);
+    cs.alignOutput(omni::ALIGN_8);
+
      CORBA::Object::_marshalObjRef(obj,cs);
      outputSetFragmentSize(g,cs.total()-12);
      *((CORBA::ULong*)(hdr + 8)) = cs.total() - 12;
@@ -1751,6 +1757,7 @@
    // Service context
    operator>>= ((CORBA::ULong)0,s);

+  s.alignOutput(omni::ALIGN_8);

    // object reference
    CORBA::Object::_marshalObjRef(obj,s);

-- 
Jon Biggar
Levanta
jon at levanta.com
650-403-7252



More information about the omniORB-list mailing list