Home | History | Annotate | Download | only in Fuzzer

Lines Matching refs:Data

28 /// Unpacks bytes from \p Data according to \p F argument types
33 template <typename Fn> bool Adapt(Fn F, const uint8_t *Data, size_t Size);
37 // - data is unpacked into std::tuple<Args...> one by one
44 size_t UnpackPrimitive(const uint8_t *Data, size_t Size, T *Value) {
47 *Value = *reinterpret_cast<const T *>(Data);
52 /// Return value equal to Size signals inability to unpack the data (typically
55 size_t UnpackSingle(const uint8_t *Data, size_t Size, T *Value);
59 size_t UnpackSingle<Type>(const uint8_t *Data, size_t Size, Type *Value) { \
60 return UnpackPrimitive(Data, Size, Value); \
86 size_t UnpackSingle<std::vector<uint8_t>>(const uint8_t *Data, size_t Size,
90 size_t Len = std::min(static_cast<size_t>(*Data), Size - 1);
91 std::vector<uint8_t> V(Data + 1, Data + 1 + Len);
97 size_t UnpackSingle<std::string>(const uint8_t *Data, size_t Size,
101 size_t Len = std::min(static_cast<size_t>(*Data), Size - 1);
102 std::string S(Data + 1, Data + 1 + Len);
112 UnpackImpl(const uint8_t *Data, size_t Size, TupleT *Tuple) {
119 UnpackImpl(const uint8_t *Data, size_t Size, TupleT *Tuple) {
120 size_t NewSize = UnpackSingle(Data, Size, &std::get<N>(*Tuple));
125 return UnpackImpl<N + 1, TupleT>(Data + (Size - NewSize), NewSize, Tuple);
130 bool Unpack(const uint8_t *Data, size_t Size, std::tuple<Args...> *Tuple) {
131 return UnpackImpl<0, std::tuple<Args...>>(Data, Size, Tuple);
168 // Unpacking data into arguments tuple of correct type and calling the function.
170 bool UnpackAndApply(Fn F, const uint8_t *Data, size_t Size) {
172 if (!Unpack(Data, Size, &Tuple))
181 template <typename Fn> bool Adapt(Fn F, const uint8_t *Data, size_t Size) {
182 return impl::UnpackAndApply(F, Data, Size);