aboutsummaryrefslogtreecommitdiff
path: root/fuzzers/fuzz_decode_message.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fuzzers/fuzz_decode_message.cpp')
-rw-r--r--fuzzers/fuzz_decode_message.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/fuzzers/fuzz_decode_message.cpp b/fuzzers/fuzz_decode_message.cpp
new file mode 100644
index 0000000..2ef734c
--- /dev/null
+++ b/fuzzers/fuzz_decode_message.cpp
@@ -0,0 +1,14 @@
+#include "olm/message.hh"
+#include "fuzzing.hh"
+
+int main(int argc, const char *argv[]) {
+ int message_fd = STDIN_FILENO;
+ uint8_t * message_buffer;
+ ssize_t message_length = check_errno(
+ "Error reading message file", read_file(message_fd, &message_buffer)
+ );
+ olm::MessageReader * reader = new olm::MessageReader;
+ decode_message(*reader, message_buffer, message_length, 8);
+ free(message_buffer);
+ delete reader;
+}