mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-10-04 21:29:21 +00:00
Reject a throttle rate that overflows
rate * 1024 wraps to zero at 2^54, which means no limit.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <limits>
|
||||
#include <torrent/throttle.h>
|
||||
#include <torrent/rate.h>
|
||||
#include <torrent/download/resource_manager.h>
|
||||
@@ -90,6 +91,9 @@ apply_throttle(const torrent::Object::list_type& args, bool up) {
|
||||
if (rate < 0)
|
||||
throw torrent::input_error("Throttle rate must be non-negative.");
|
||||
|
||||
if (rate > (std::numeric_limits<int64_t>::max() >> 10))
|
||||
throw torrent::input_error("Throttle rate is too large.");
|
||||
|
||||
auto itr = control->core()->throttles().find(name);
|
||||
|
||||
if (itr == control->core()->throttles().end())
|
||||
|
||||
Reference in New Issue
Block a user