diff options
Diffstat (limited to 'cpp/src/Ice/BasicStream.cpp')
-rw-r--r-- | cpp/src/Ice/BasicStream.cpp | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/cpp/src/Ice/BasicStream.cpp b/cpp/src/Ice/BasicStream.cpp index 2a94e724f86..e636c0d952d 100644 --- a/cpp/src/Ice/BasicStream.cpp +++ b/cpp/src/Ice/BasicStream.cpp @@ -455,6 +455,15 @@ IceInternal::BasicStream::readBlob(vector<Byte>& v, Int sz) } } +void IceInternal::BasicStream::write(Byte v, int end) +{ + if(v >= end) + { + throw MarshalException(__FILE__, __LINE__, "enumerator out of range"); + } + write(v); +} + void IceInternal::BasicStream::write(const Byte* begin, const Byte* end) { @@ -469,6 +478,16 @@ IceInternal::BasicStream::write(const Byte* begin, const Byte* end) } void +IceInternal::BasicStream::read(Byte& b, int end) +{ + read(b); + if(b >= end) + { + throw MarshalException(__FILE__, __LINE__, "enumerator out of range"); + } +} + +void IceInternal::BasicStream::read(pair<const Byte*, const Byte*>& v) { Int sz; @@ -625,6 +644,16 @@ IceInternal::BasicStream::write(Short v) } void +IceInternal::BasicStream::write(Short v, int end) +{ + if(v < 0 || v >= end) + { + throw MarshalException(__FILE__, __LINE__, "enumerator out of range"); + } + write(v); +} + +void IceInternal::BasicStream::write(const Short* begin, const Short* end) { Int sz = static_cast<Int>(end - begin); @@ -669,6 +698,16 @@ IceInternal::BasicStream::read(Short& v) } void +IceInternal::BasicStream::read(Short& v, int end) +{ + read(v); + if(v < 0 || v >= end) + { + throw MarshalException(__FILE__, __LINE__, "enumerator out of range"); + } +} + +void IceInternal::BasicStream::read(vector<Short>& v) { Int sz; @@ -740,6 +779,26 @@ IceInternal::BasicStream::read(pair<const Short*, const Short*>& v) } void +IceInternal::BasicStream::read(Int& v, int end) +{ + read(v); + if(v < 0 || v >= end) + { + throw MarshalException(__FILE__, __LINE__, "enumerator out of range"); + } +} + +void +IceInternal::BasicStream::write(Int v, int end) +{ + if(v < 0 || v >= end) + { + throw MarshalException(__FILE__, __LINE__, "enumerator out of range"); + } + write(v); +} + +void IceInternal::BasicStream::write(const Int* begin, const Int* end) { Int sz = static_cast<Int>(end - begin); |