diff options
-rw-r--r-- | TAO/ChangeLog | 14 | ||||
-rw-r--r-- | TAO/tao/Any.cpp | 4 | ||||
-rw-r--r-- | TAO/tao/CDR_Encaps_Codec.cpp | 3 | ||||
-rw-r--r-- | TAO/tao/NVList.cpp | 7 |
4 files changed, 27 insertions, 1 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index 635d2deafc3..35b39e474cd 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,17 @@ +Fri May 16 18:40:08 2003 Balachandran Natarajan <bala@dre.vanderbilt.edu> + + * tao/Any.cpp: + * tao/CDR_Encaps_Codec.cpp: + * tao/NVList.cpp: Few hours of nonstop debugging opened up a + problem with a way ptrdiff_t was used. ptrdiff_t is signed + whereas ptr_arith_t was unsigned. This lead to cases where + alignments got a negative value on Linux and memcpy data into + and from CDR streams were totally busted. This lead to crashes + in Any tests in our daily builds. + + This will not fix all the problems with Any's. There are some + more fixes which would be checked in in the next few days. + Thu May 15 14:54:31 2003 Simon McQueen <sm@prismtechnologies.com> * tests/Smart_Proxies/Makefile: diff --git a/TAO/tao/Any.cpp b/TAO/tao/Any.cpp index b1bc9961bce..22c9e52295b 100644 --- a/TAO/tao/Any.cpp +++ b/TAO/tao/Any.cpp @@ -515,6 +515,10 @@ TAO::Unknown_IDL_Type::_tao_decode (TAO_InputCDR &cdr ACE_CDR::mb_align (this->cdr_); ptrdiff_t offset = ptrdiff_t (begin) % ACE_CDR::MAX_ALIGNMENT; + + if (offset < 0) + offset += ACE_CDR::MAX_ALIGNMENT; + this->cdr_->rd_ptr (offset); this->cdr_->wr_ptr (offset + size); diff --git a/TAO/tao/CDR_Encaps_Codec.cpp b/TAO/tao/CDR_Encaps_Codec.cpp index d5eff01ffc5..12330736b89 100644 --- a/TAO/tao/CDR_Encaps_Codec.cpp +++ b/TAO/tao/CDR_Encaps_Codec.cpp @@ -324,6 +324,9 @@ TAO_CDR_Encaps_Codec::decode_value (const CORBA::OctetSeq & data, ptrdiff_t offset = ptrdiff_t (begin) % ACE_CDR::MAX_ALIGNMENT; + if (offset < 0) + offset += ACE_CDR::MAX_ALIGNMENT; + mb.rd_ptr (offset); mb.wr_ptr (offset + size); diff --git a/TAO/tao/NVList.cpp b/TAO/tao/NVList.cpp index 2c2828a79c2..c112f7f6ef3 100644 --- a/TAO/tao/NVList.cpp +++ b/TAO/tao/NVList.cpp @@ -445,7 +445,12 @@ CORBA::NVList::_tao_target_alignment (void) } const char* rd = this->incoming_->start ()->rd_ptr (); - return ptrdiff_t(rd) % ACE_CDR::MAX_ALIGNMENT; + ptrdiff_t t = ptrdiff_t (rd) % ACE_CDR::MAX_ALIGNMENT; + + if (t < 0) + t += ACE_CDR::MAX_ALIGNMENT; + + return t; } void |