File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -214,4 +214,18 @@ NODISCARD inline bool ContainsSpentInput(const CTransaction& tx, const CCoinsVie
214
214
return false ;
215
215
}
216
216
217
+ /* *
218
+ * Returns a byte vector of specified size regardless of the number of remaining bytes available
219
+ * from the fuzzer. Pads with zero value bytes if needed to achieve the specified size.
220
+ */
221
+ NODISCARD inline std::vector<uint8_t > ConsumeFixedLengthByteVector (FuzzedDataProvider& fuzzed_data_provider, const size_t length) noexcept
222
+ {
223
+ std::vector<uint8_t > result (length);
224
+ const std::vector<uint8_t > random_bytes = fuzzed_data_provider.ConsumeBytes <uint8_t >(length);
225
+ if (!random_bytes.empty ()) {
226
+ std::memcpy (result.data (), random_bytes.data (), random_bytes.size ());
227
+ }
228
+ return result;
229
+ }
230
+
217
231
#endif // BITCOIN_TEST_FUZZ_UTIL_H
You can’t perform that action at this time.
0 commit comments