summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-11-17 21:33:46 +0000
committercoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-11-17 21:33:46 +0000
commitb3579c1159bce1ec6de489093cab5812d64ad940 (patch)
treef79e2a757ea53092b833f0bf6f256cf72b026500
parent425dbb7cb3505e77ec3b98e1fe91816ae51e04dc (diff)
downloadATCD-b3579c1159bce1ec6de489093cab5812d64ad940.tar.gz
ChangeLogTag:Tue Nov 17 11:28:20 1998 Carlos O'Ryan <coryan@cs.wustl.edu>
-rw-r--r--TAO/ChangeLog-98c5
-rw-r--r--TAO/tao/decode.cpp11
2 files changed, 15 insertions, 1 deletions
diff --git a/TAO/ChangeLog-98c b/TAO/ChangeLog-98c
index 7c2c4eb9d0c..c5453a8d26c 100644
--- a/TAO/ChangeLog-98c
+++ b/TAO/ChangeLog-98c
@@ -1,5 +1,10 @@
Tue Nov 17 11:28:20 1998 Carlos O'Ryan <coryan@cs.wustl.edu>
+ * tao/decode.cpp:
+ Fixed problems with Any demarshaling, the buffer allocated could
+ be misaligned and sometimes too small. Thanks to Arturo Montes
+ <mitosys@colomsat.com.co> for pointing this out.
+
* orbsvcs/orbsvcs/Event/Dispatching_Modules.i:
* orbsvcs/orbsvcs/Event/Dispatching_Modules.cpp:
When dispatching events the push() method may raise an
diff --git a/TAO/tao/decode.cpp b/TAO/tao/decode.cpp
index d0ca25aa876..9744f8e74c9 100644
--- a/TAO/tao/decode.cpp
+++ b/TAO/tao/decode.cpp
@@ -172,8 +172,17 @@ TAO_Marshal_Any::decode (CORBA::TypeCode_ptr,
end = temp.rd_ptr ();
ACE_Message_Block* cdr;
- ACE_NEW_RETURN (cdr, ACE_Message_Block (end - begin),
+
+ // We need to allocate more memory than in the original
+ // stream, first to guarantee that the buffer is aligned in
+ // memory and next because the realignment may introduce
+ // extra padding. 2*MAX_ALIGNMENT should be enough.
+ ACE_NEW_RETURN (cdr,
+ ACE_Message_Block (end - begin
+ + 2*CDR::MAX_ALIGNMENT),
CORBA::TypeCode::TRAVERSE_STOP);
+ // Align the buffer before creating the CDR stream.
+ CDR::mb_align (cdr);
TAO_OutputCDR out (cdr);
retval = out.append (elem_tc.in (), stream, env);