aboutsummaryrefslogtreecommitdiff
path: root/fuzzers/fuzz_unpickle_session.cpp
diff options
context:
space:
mode:
authorMark Haines <mjark@negativecurvature.net>2016-05-25 14:32:03 +0100
committerMark Haines <mjark@negativecurvature.net>2016-05-25 14:32:03 +0100
commit024685f3db2be6c4cfb55670ecc92d8d1a0c9a8d (patch)
tree7e3c0f523052df89a447aedbc7481a40d462b9b9 /fuzzers/fuzz_unpickle_session.cpp
parent8d31f42b1e5fd198918166edeec61f57059c6db9 (diff)
parentf47aabd094a4eafeed5a510c650d7a063a148076 (diff)
Merge branch 'markjh/fuzzingII'
Diffstat (limited to 'fuzzers/fuzz_unpickle_session.cpp')
-rw-r--r--fuzzers/fuzz_unpickle_session.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/fuzzers/fuzz_unpickle_session.cpp b/fuzzers/fuzz_unpickle_session.cpp
new file mode 100644
index 0000000..6edbc96
--- /dev/null
+++ b/fuzzers/fuzz_unpickle_session.cpp
@@ -0,0 +1,14 @@
+#include "olm/session.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::Session * session = new olm::Session;
+ unpickle(pickle_buffer, pickle_buffer + pickle_length, *session);
+ free(pickle_buffer);
+ delete session;
+}