diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2012-02-26 19:45:25 +0900 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2012-02-26 19:45:25 +0900 |
| commit | ad11d746f09977ce151ef6f49dd971f4af451d44 (patch) | |
| tree | 77c171847cbfb928daeb22fa5a3eab1bb483a1ca /src | |
| parent | 7a1cba2c596dc6330fd30b6249b24a894b5bea62 (diff) | |
Only accepts 32 bit integer values from int and i4 elements in XML-RPC.
Fixed overflow in AbstractPaginationRpcMethod::getPaginationRange().
Fixes bug#3494165
Diffstat (limited to 'src')
| -rw-r--r-- | src/RpcMethodImpl.h | 12 | ||||
| -rw-r--r-- | src/XmlRpcRequestParserStateImpl.cc | 4 |
2 files changed, 8 insertions, 8 deletions
diff --git a/src/RpcMethodImpl.h b/src/RpcMethodImpl.h index fb1cccc1..1fe609af 100644 --- a/src/RpcMethodImpl.h +++ b/src/RpcMethodImpl.h @@ -331,11 +331,11 @@ private: template<typename InputIterator> std::pair<InputIterator, InputIterator> getPaginationRange - (int offset, int num, InputIterator first, InputIterator last) + (int64_t offset, int64_t num, InputIterator first, InputIterator last) { - int size = std::distance(first, last); + int64_t size = std::distance(first, last); if(offset < 0) { - int tempoffset = offset+size; + int64_t tempoffset = offset+size; if(tempoffset < 0) { return std::make_pair(last, last); } @@ -347,7 +347,7 @@ private: } else if(size <= offset) { return std::make_pair(last, last); } - int lastDistance; + int64_t lastDistance; if(size < offset+num) { lastDistance = size; } else { @@ -369,8 +369,8 @@ protected: if(numParam->i() < 0) { throw DL_ABORT_EX("The parameter num must be zero or positive integer."); } - int offset = offsetParam->i(); - int num = numParam->i(); + int64_t offset = offsetParam->i(); + int64_t num = numParam->i(); std::vector<std::string> keys; toStringList(std::back_inserter(keys), keysParam); const std::deque<SharedHandle<T> >& items = getItems(e); diff --git a/src/XmlRpcRequestParserStateImpl.cc b/src/XmlRpcRequestParserStateImpl.cc index 947a378a..4f71ae13 100644 --- a/src/XmlRpcRequestParserStateImpl.cc +++ b/src/XmlRpcRequestParserStateImpl.cc @@ -200,8 +200,8 @@ void IntXmlRpcRequestParserState::endElement const char* name, const std::string& characters) { - int64_t value; - if(util::parseLLIntNoThrow(value, characters)) { + int32_t value; + if(util::parseIntNoThrow(value, characters)) { psm->setCurrentFrameValue(Integer::g(value)); } else { // nothing to do here: We just leave current frame value to null. |
