summaryrefslogtreecommitdiff
path: root/ACE/ace/CDR_Stream.cpp
diff options
context:
space:
mode:
authoriliyan <iliyan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2007-02-26 20:54:42 +0000
committeriliyan <iliyan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2007-02-26 20:54:42 +0000
commit56c821586f3b51032cbb13ee5f2f208dfe71d198 (patch)
treea0b8fe120dcf84348b36895f0b285519f3a3ba29 /ACE/ace/CDR_Stream.cpp
parent19c6a057db317a19ae1c5f345edf2d3aa285e46a (diff)
downloadATCD-56c821586f3b51032cbb13ee5f2f208dfe71d198.tar.gz
ChangeLogTag: Mon Feb 26 19:06:36 UTC 2007 Iliyan Jeliazkov <iliyan@ociweb.com>
Diffstat (limited to 'ACE/ace/CDR_Stream.cpp')
-rw-r--r--ACE/ace/CDR_Stream.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/ACE/ace/CDR_Stream.cpp b/ACE/ace/CDR_Stream.cpp
index b033d8a1587..05173173099 100644
--- a/ACE/ace/CDR_Stream.cpp
+++ b/ACE/ace/CDR_Stream.cpp
@@ -188,6 +188,17 @@ ACE_OutputCDR::grow_and_adjust (size_t size,
ACE_Time_Value::max_time,
this->current_->data_block ()->data_block_allocator ()),
-1);
+
+ // Message block initialization may fail while the construction
+ // succeds. Since as a matter of policy, ACE may throw no
+ // exceptions, we have to do a separate check like this.
+ if (tmp->size () != newsize)
+ {
+ delete tmp;
+ errno = ENOMEM;
+ return -1;
+ }
+
this->good_bit_ = true;
#if !defined (ACE_LACKS_CDR_ALIGNMENT)
@@ -1701,8 +1712,8 @@ ACE_InputCDR::clone_from (ACE_InputCDR &cdr)
db =
cdr.start_.data_block ()->clone_nocopy ();
- if (db->size ((wr_bytes) +
- ACE_CDR::MAX_ALIGNMENT) == -1)
+ if (db == 0 || db->size ((wr_bytes) +
+ ACE_CDR::MAX_ALIGNMENT) == -1)
return 0;
// Replace our data block by using the incoming CDR stream.