Skip to content

Commit 7bd1ed0

Browse files
committed
Merge pull request #6737
0325474 epee: further defending against exceptions in command handlers (moneromooo-monero)
2 parents 9006119 + 0325474 commit 7bd1ed0

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

contrib/epee/include/storages/levin_abstract_invoke2.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ namespace epee
290290
#define BEGIN_INVOKE_MAP2(owner_type) \
291291
template <class t_context> int handle_invoke_map(bool is_notify, int command, const epee::span<const uint8_t> in_buff, std::string& buff_out, t_context& context, bool& handled) \
292292
{ \
293+
try { \
293294
typedef owner_type internal_owner_type_name;
294295

295296
#define HANDLE_INVOKE2(command_id, func, type_name_in, typename_out) \
@@ -335,7 +336,13 @@ namespace epee
335336
LOG_ERROR("Unknown command:" << command); \
336337
on_levin_traffic(context, false, false, true, in_buff.size(), "invalid-command"); \
337338
return LEVIN_ERROR_CONNECTION_HANDLER_NOT_DEFINED; \
339+
} \
340+
catch (const std::exception &e) { \
341+
MERROR("Error in handle_invoke_map: " << e.what()); \
342+
return LEVIN_ERROR_CONNECTION_TIMEDOUT; /* seems kinda appropriate */ \
343+
} \
338344
}
345+
339346
}
340347
}
341348

0 commit comments

Comments
 (0)