summaryrefslogtreecommitdiff
path: root/cpp/src/Slice/CsUtil.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/Slice/CsUtil.cpp')
-rwxr-xr-xcpp/src/Slice/CsUtil.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/cpp/src/Slice/CsUtil.cpp b/cpp/src/Slice/CsUtil.cpp
index c6dfb006e95..9b9c7c801c2 100755
--- a/cpp/src/Slice/CsUtil.cpp
+++ b/cpp/src/Slice/CsUtil.cpp
@@ -602,6 +602,13 @@ Slice::CsGenerator::writeMarshalUnmarshalCode(Output &out,
}
if(marshal)
{
+ if(streamingAPI)
+ {
+ out << nl << "if((int)" << param << " < 0 || (int)" << param << " >= " << sz << ")";
+ out << sb;
+ out << nl << "throw new Ice.MarshalException(\"enumerator out of range\");";
+ out << eb;
+ }
out << nl << stream << '.' << func << '(' << cast << param;
if(!streamingAPI)
{
@@ -617,6 +624,13 @@ Slice::CsGenerator::writeMarshalUnmarshalCode(Output &out,
out << sz;
}
out << ")" << ';';
+ if(streamingAPI)
+ {
+ out << nl << "if((int)" << param << " < 0 || (int)" << param << " >= " << sz << ")";
+ out << sb;
+ out << nl << "throw new Ice.MarshalException(\"enumerator out of range\");";
+ out << eb;
+ }
}
return;
}