summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_cs.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_cs.cpp
index a2647093471..0b9f85f7f49 100644
--- a/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_cs.cpp
@@ -191,6 +191,14 @@ be_visitor_sequence_cdr_op_cs::visit_sequence (be_sequence *node)
*os << "// If length is 0 we return true." << be_nl;
*os << "if (0 >= _tao_seq_len) " << be_idt_nl;
*os << "return 1;" << be_uidt_nl;
+
+ // Add a sanity check for the length of a sequence.
+ *os << "// Add a check to the length of the sequence" << be_nl;
+ *os << "// to make sure it does not exceed the length" << be_nl;
+ *os << "// of the stream. (See bug 58.)" << be_nl;
+ *os << "if (_tao_seq_len > strm.length())" << be_idt_nl;
+ *os << "return 0;" << be_uidt_nl;
+
*os << "// retrieve all the elements" << be_nl;