}
+static inline std::string after_delim(std::string_view delim)
+{
+ // assert: ! delim.empty()
+ std::string result{delim.data(), delim.length()};
+ result += char(255);
+ return result;
+}
+
+
/**
* Get ordered listing of the objects in a bucket.
*
* is_truncated: if number of objects in the bucket is bigger than
* max, then truncated.
*/
-static inline std::string after_delim(std::string_view delim)
-{
- // assert: ! delim.empty()
- std::string result{delim.data(), delim.length()};
- result += char(255);
- return result;
-}
-
-int RGWRados::Bucket::List::list_objects_ordered(
- int64_t max,
- vector<rgw_bucket_dir_entry> *result,
- map<string, bool> *common_prefixes,
- bool *is_truncated,
- optional_yield y)
+int RGWRados::Bucket::List::list_objects_ordered(int64_t max_p,
+ vector<rgw_bucket_dir_entry> *result,
+ map<string, bool> *common_prefixes,
+ bool *is_truncated,
+ optional_yield y)
{
RGWRados *store = target->get_store();
CephContext *cct = store->ctx();
int count = 0;
bool truncated = true;
- int read_ahead = std::max(cct->_conf->rgw_list_bucket_min_readahead,max);
+ const int64_t max = // protect against memory issues and non-positive vals
+ std::min(bucket_list_objects_absolute_max, std::max(int64_t(0), max_p));
+ int read_ahead = std::max(cct->_conf->rgw_list_bucket_min_readahead, max);
result->clear();
* is_truncated: if number of objects in the bucket is bigger than max, then
* truncated.
*/
-int RGWRados::Bucket::List::list_objects_unordered(int64_t max,
+int RGWRados::Bucket::List::list_objects_unordered(int64_t max_p,
vector<rgw_bucket_dir_entry> *result,
map<string, bool> *common_prefixes,
bool *is_truncated,
int count = 0;
bool truncated = true;
+ const int64_t max = // protect against memory issues and non-positive vals
+ std::min(bucket_list_objects_absolute_max, std::max(int64_t(1), max_p));
+
// read a few extra in each call to cls_bucket_list_unordered in
// case some are filtered out due to namespace matching, versioning,
// filtering, etc.