diff --git a/src/test/fuzz/util/descriptor.cpp b/src/test/fuzz/util/descriptor.cpp index 9e52e990a2a..4e563eac4d7 100644 --- a/src/test/fuzz/util/descriptor.cpp +++ b/src/test/fuzz/util/descriptor.cpp @@ -74,7 +74,7 @@ std::optional MockedDescriptorConverter::GetDescriptor(std::string_ return desc; } -bool HasDeepDerivPath(const FuzzBufferType& buff, const int max_depth) +bool HasDeepDerivPath(std::span buff, const int max_depth) { auto depth{0}; for (const auto& ch: buff) { @@ -88,7 +88,7 @@ bool HasDeepDerivPath(const FuzzBufferType& buff, const int max_depth) return false; } -bool HasTooManySubFrag(const FuzzBufferType& buff, const int max_subs, const size_t max_nested_subs) +bool HasTooManySubFrag(std::span buff, const int max_subs, const size_t max_nested_subs) { // We use a stack because there may be many nested sub-frags. std::stack counts; @@ -112,7 +112,7 @@ bool HasTooManySubFrag(const FuzzBufferType& buff, const int max_subs, const siz return false; } -bool HasTooManyWrappers(const FuzzBufferType& buff, const int max_wrappers) +bool HasTooManyWrappers(std::span buff, const int max_wrappers) { // The number of nested wrappers. Nested wrappers are always characters which follow each other so we don't have to // use a stack as we do above when counting the number of sub-fragments. diff --git a/src/test/fuzz/util/descriptor.h b/src/test/fuzz/util/descriptor.h index ea928c39f04..41605dd98d6 100644 --- a/src/test/fuzz/util/descriptor.h +++ b/src/test/fuzz/util/descriptor.h @@ -53,7 +53,7 @@ constexpr int MAX_DEPTH{2}; * Whether the buffer, if it represents a valid descriptor, contains a derivation path deeper than * a given maximum depth. Note this may also be hit for deriv paths in origins. */ -bool HasDeepDerivPath(const FuzzBufferType& buff, const int max_depth = MAX_DEPTH); +bool HasDeepDerivPath(std::span buff, int max_depth = MAX_DEPTH); //! Default maximum number of sub-fragments. constexpr int MAX_SUBS{1'000}; @@ -64,8 +64,8 @@ constexpr size_t MAX_NESTED_SUBS{10'000}; * Whether the buffer, if it represents a valid descriptor, contains a fragment with more * sub-fragments than the given maximum. */ -bool HasTooManySubFrag(const FuzzBufferType& buff, const int max_subs = MAX_SUBS, - const size_t max_nested_subs = MAX_NESTED_SUBS); +bool HasTooManySubFrag(std::span buff, int max_subs = MAX_SUBS, + size_t max_nested_subs = MAX_NESTED_SUBS); //! Default maximum number of wrappers per fragment. constexpr int MAX_WRAPPERS{100}; @@ -74,6 +74,6 @@ constexpr int MAX_WRAPPERS{100}; * Whether the buffer, if it represents a valid descriptor, contains a fragment with more * wrappers than the given maximum. */ -bool HasTooManyWrappers(const FuzzBufferType& buff, const int max_wrappers = MAX_WRAPPERS); +bool HasTooManyWrappers(std::span buff, int max_wrappers = MAX_WRAPPERS); #endif // BITCOIN_TEST_FUZZ_UTIL_DESCRIPTOR_H