aboutsummaryrefslogtreecommitdiff
path: root/fuzzers/fuzz_unpickle_account.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fuzzers/fuzz_unpickle_account.cpp')
-rw-r--r--fuzzers/fuzz_unpickle_account.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/fuzzers/fuzz_unpickle_account.cpp b/fuzzers/fuzz_unpickle_account.cpp
new file mode 100644
index 0000000..12c6d9b
--- /dev/null
+++ b/fuzzers/fuzz_unpickle_account.cpp
@@ -0,0 +1,14 @@
+#include "olm/account.hh"
+#include "fuzzing.hh"
+
+int main(int argc, const char *argv[]) {
+ int pickle_fd = STDIN_FILENO;
+ uint8_t * pickle_buffer;
+ ssize_t pickle_length = check_errno(
+ "Error reading pickle file", read_file(pickle_fd, &pickle_buffer)
+ );
+ olm::Account * account = new olm::Account;
+ unpickle(pickle_buffer, pickle_buffer + pickle_length, *account);
+ free(pickle_buffer);
+ delete account;
+}