diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2011-11-12 01:06:52 +0900 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2011-11-12 01:06:52 +0900 |
| commit | 2f4393d17c7120912ad7b2b820b46124010a5a5e (patch) | |
| tree | 78c0e632175fc4c9b61d08c62b46a905cb4c853d /src/bencode2.cc | |
| parent | 226480ad605cb9f7c4b5dbb0167f3fd67c8672ce (diff) | |
Rewritten parse*Int
Diffstat (limited to 'src/bencode2.cc')
| -rw-r--r-- | src/bencode2.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/bencode2.cc b/src/bencode2.cc index 74198b0d..78071879 100644 --- a/src/bencode2.cc +++ b/src/bencode2.cc @@ -63,7 +63,8 @@ decoderawstring(InputIterator first, InputIterator last) InputIterator i = first; int32_t len; for(; i != last && *i != ':'; ++i); - if(i == last || i == first || !util::parseIntNoThrow(len, first, i) || + if(i == last || i == first || + !util::parseIntNoThrow(len, std::string(first, i)) || len < 0) { throw DL_ABORT_EX2("Bencode decoding failed:" " A positive integer expected but none found.", @@ -100,7 +101,7 @@ decodeinteger(InputIterator first, InputIterator last) InputIterator i = first; for(; i != last && *i != 'e'; ++i); Integer::ValueType iv; - if(i == last || !util::parseLLIntNoThrow(iv, first, i)) { + if(i == last || !util::parseLLIntNoThrow(iv, std::string(first, i))) { throw DL_ABORT_EX2("Bencode decoding failed:" " Integer expected but none found", error_code::BENCODE_PARSE_ERROR); |
