From a89ce3cd7bd69fa99f21f902fef4758f342768bb Mon Sep 17 00:00:00 2001 From: noctuum <25441068+noctuum@users.noreply.github.com> Date: Mon, 28 Sep 2026 16:18:02 +0500 Subject: [PATCH] Check first against last in parse_object A command ending in `=` reaches it with an empty range. --- src/rpc/parse.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rpc/parse.cc b/src/rpc/parse.cc index e49dde66..b4414665 100644 --- a/src/rpc/parse.cc +++ b/src/rpc/parse.cc @@ -161,7 +161,7 @@ parse_object(const char* first, const char* last, torrent::Object* dest, bool (* if (++depth >= max_parse_depth) throw torrent::input_error("Max parse depth reached."); - if (*first == '{') { + if (first != last && *first == '{') { *dest = torrent::Object::create_list(); first = parse_list(first + 1, last, dest, &parse_is_delim_block, depth); first = parse_skip_wspace(first, last); @@ -171,7 +171,7 @@ parse_object(const char* first, const char* last, torrent::Object* dest, bool (* return ++first; - } else if (*first == '(') { + } else if (first != last && *first == '(') { int32_t parentheses = 1; while (first + 1 != last && *(first + 1) == '(') {