mirror of
https://github.com/vtnerd/monero-lws.git
synced 2024-11-16 09:17:37 +00:00
Fix divide by zero in subaddresses n_maj (#114)
Some checks failed
unix-ci / build-tests (macos-12, WITH_RMQ=OFF) (push) Has been cancelled
unix-ci / build-tests (macos-12, WITH_RMQ=ON) (push) Has been cancelled
unix-ci / build-tests (macos-latest, WITH_RMQ=OFF) (push) Has been cancelled
unix-ci / build-tests (macos-latest, WITH_RMQ=ON) (push) Has been cancelled
unix-ci / build-tests (ubuntu-20.04, WITH_RMQ=OFF) (push) Has been cancelled
unix-ci / build-tests (ubuntu-20.04, WITH_RMQ=ON) (push) Has been cancelled
unix-ci / build-tests (ubuntu-22.04, WITH_RMQ=OFF) (push) Has been cancelled
unix-ci / build-tests (ubuntu-22.04, WITH_RMQ=ON) (push) Has been cancelled
unix-ci / build-tests (ubuntu-latest, WITH_RMQ=OFF) (push) Has been cancelled
unix-ci / build-tests (ubuntu-latest, WITH_RMQ=ON) (push) Has been cancelled
Some checks failed
unix-ci / build-tests (macos-12, WITH_RMQ=OFF) (push) Has been cancelled
unix-ci / build-tests (macos-12, WITH_RMQ=ON) (push) Has been cancelled
unix-ci / build-tests (macos-latest, WITH_RMQ=OFF) (push) Has been cancelled
unix-ci / build-tests (macos-latest, WITH_RMQ=ON) (push) Has been cancelled
unix-ci / build-tests (ubuntu-20.04, WITH_RMQ=OFF) (push) Has been cancelled
unix-ci / build-tests (ubuntu-20.04, WITH_RMQ=ON) (push) Has been cancelled
unix-ci / build-tests (ubuntu-22.04, WITH_RMQ=OFF) (push) Has been cancelled
unix-ci / build-tests (ubuntu-22.04, WITH_RMQ=ON) (push) Has been cancelled
unix-ci / build-tests (ubuntu-latest, WITH_RMQ=OFF) (push) Has been cancelled
unix-ci / build-tests (ubuntu-latest, WITH_RMQ=ON) (push) Has been cancelled
This commit is contained in:
parent
57c67ae0e4
commit
79564f714f
1 changed files with 6 additions and 6 deletions
|
@ -759,16 +759,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