mirror of
https://github.com/vtnerd/monero-lws.git
synced 2024-12-22 11:29:24 +00:00
Fix divide by zero in subaddresses n_maj (#114)
Some checks are pending
unix-ci / build-tests (macos-12, WITH_RMQ=OFF) (push) Waiting to run
unix-ci / build-tests (macos-12, WITH_RMQ=ON) (push) Waiting to run
unix-ci / build-tests (macos-latest, WITH_RMQ=OFF) (push) Waiting to run
unix-ci / build-tests (macos-latest, WITH_RMQ=ON) (push) Waiting to run
unix-ci / build-tests (ubuntu-20.04, WITH_RMQ=OFF) (push) Waiting to run
unix-ci / build-tests (ubuntu-20.04, WITH_RMQ=ON) (push) Waiting to run
unix-ci / build-tests (ubuntu-22.04, WITH_RMQ=OFF) (push) Waiting to run
unix-ci / build-tests (ubuntu-22.04, WITH_RMQ=ON) (push) Waiting to run
unix-ci / build-tests (ubuntu-latest, WITH_RMQ=OFF) (push) Waiting to run
unix-ci / build-tests (ubuntu-latest, WITH_RMQ=ON) (push) Waiting to run
Some checks are pending
unix-ci / build-tests (macos-12, WITH_RMQ=OFF) (push) Waiting to run
unix-ci / build-tests (macos-12, WITH_RMQ=ON) (push) Waiting to run
unix-ci / build-tests (macos-latest, WITH_RMQ=OFF) (push) Waiting to run
unix-ci / build-tests (macos-latest, WITH_RMQ=ON) (push) Waiting to run
unix-ci / build-tests (ubuntu-20.04, WITH_RMQ=OFF) (push) Waiting to run
unix-ci / build-tests (ubuntu-20.04, WITH_RMQ=ON) (push) Waiting to run
unix-ci / build-tests (ubuntu-22.04, WITH_RMQ=OFF) (push) Waiting to run
unix-ci / build-tests (ubuntu-22.04, WITH_RMQ=ON) (push) Waiting to run
unix-ci / build-tests (ubuntu-latest, WITH_RMQ=OFF) (push) Waiting to run
unix-ci / build-tests (ubuntu-latest, WITH_RMQ=ON) (push) Waiting to run
This commit is contained in:
parent
9b99593397
commit
7863ccba44
1 changed files with 6 additions and 6 deletions
|
@ -713,16 +713,16 @@ namespace lws
|
|||
const std::uint32_t n_major = req.n_maj.value_or(50);
|
||||
const std::uint32_t n_minor = req.n_min.value_or(500);
|
||||
const bool get_all = req.get_all.value_or(true);
|
||||
|
||||
if (std::numeric_limits<std::uint32_t>::max() / n_major < n_minor)
|
||||
return {lws::error::max_subaddresses};
|
||||
if (options.max_subaddresses < n_major * n_minor)
|
||||
return {lws::error::max_subaddresses};
|
||||
|
||||
|
||||
std::vector<db::subaddress_dict> new_ranges;
|
||||
std::vector<db::subaddress_dict> all_ranges;
|
||||
if (n_major && n_minor)
|
||||
{
|
||||
if (std::numeric_limits<std::uint32_t>::max() / n_major < n_minor)
|
||||
return {lws::error::max_subaddresses};
|
||||
if (options.max_subaddresses < n_major * n_minor)
|
||||
return {lws::error::max_subaddresses};
|
||||
|
||||
std::vector<db::subaddress_dict> ranges;
|
||||
ranges.reserve(n_major);
|
||||
for (std::uint64_t elem : boost::counting_range(std::uint64_t(major_i), std::uint64_t(major_i) + n_major))
|
||||
|
|
Loading…
Reference in a new issue