diff options
author | Michi Henning <michi@zeroc.com> | 2007-11-26 12:04:19 +1000 |
---|---|---|
committer | Michi Henning <michi@zeroc.com> | 2007-11-26 12:04:19 +1000 |
commit | 36045f37b39ab655bea41947d5a8145c5a514328 (patch) | |
tree | 3b6e8436f6f9d6f1ba390a6ff73053549829f40d /cpp/src/Ice/BasicStream.cpp | |
parent | Fixed VC6 build failures (diff) | |
download | ice-36045f37b39ab655bea41947d5a8145c5a514328.tar.bz2 ice-36045f37b39ab655bea41947d5a8145c5a514328.tar.xz ice-36045f37b39ab655bea41947d5a8145c5a514328.zip |
Bug 2474.
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); |