mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-10-08 07:09:21 +00:00
Check first against last in parse_object
A command ending in `=` reaches it with an empty range.
This commit is contained in:
+2
-2
@@ -161,7 +161,7 @@ parse_object(const char* first, const char* last, torrent::Object* dest, bool (*
|
|||||||
if (++depth >= max_parse_depth)
|
if (++depth >= max_parse_depth)
|
||||||
throw torrent::input_error("Max parse depth reached.");
|
throw torrent::input_error("Max parse depth reached.");
|
||||||
|
|
||||||
if (*first == '{') {
|
if (first != last && *first == '{') {
|
||||||
*dest = torrent::Object::create_list();
|
*dest = torrent::Object::create_list();
|
||||||
first = parse_list(first + 1, last, dest, &parse_is_delim_block, depth);
|
first = parse_list(first + 1, last, dest, &parse_is_delim_block, depth);
|
||||||
first = parse_skip_wspace(first, last);
|
first = parse_skip_wspace(first, last);
|
||||||
@@ -171,7 +171,7 @@ parse_object(const char* first, const char* last, torrent::Object* dest, bool (*
|
|||||||
|
|
||||||
return ++first;
|
return ++first;
|
||||||
|
|
||||||
} else if (*first == '(') {
|
} else if (first != last && *first == '(') {
|
||||||
int32_t parentheses = 1;
|
int32_t parentheses = 1;
|
||||||
|
|
||||||
while (first + 1 != last && *(first + 1) == '(') {
|
while (first + 1 != last && *(first + 1) == '(') {
|
||||||
|
|||||||
Reference in New Issue
Block a user