aboutsummaryrefslogtreecommitdiff
path: root/src/tests/test-sms-part-cdma-fuzzer.c
diff options
context:
space:
mode:
authorAleksander Morgado <aleksandermj@chromium.org>2023-03-30 12:38:05 +0000
committerAleksander Morgado <aleksander@aleksander.es>2023-03-30 13:19:30 +0000
commit3aefc983b5d73b2c822807b23be9f76a95b11139 (patch)
tree5150e42fc26238751baef6232b29ce41555e043b /src/tests/test-sms-part-cdma-fuzzer.c
parentea441d0f895c12405931ec80d23c49118a964268 (diff)
sms-part-3gpp|cdma: new fuzzer tests
Diffstat (limited to 'src/tests/test-sms-part-cdma-fuzzer.c')
-rw-r--r--src/tests/test-sms-part-cdma-fuzzer.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/tests/test-sms-part-cdma-fuzzer.c b/src/tests/test-sms-part-cdma-fuzzer.c
new file mode 100644
index 00000000..86d48767
--- /dev/null
+++ b/src/tests/test-sms-part-cdma-fuzzer.c
@@ -0,0 +1,39 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details:
+ *
+ * Copyright (C) 2023 Google, Inc.
+ */
+
+#include <config.h>
+#include <string.h>
+#include <stdint.h>
+#include <glib.h>
+
+#define _LIBMM_INSIDE_MM
+#include <libmm-glib.h>
+
+#include "mm-sms-part-cdma.h"
+
+int
+LLVMFuzzerTestOneInput (const uint8_t *data,
+ size_t size)
+{
+ g_autoptr(MMSmsPart) part = NULL;
+ g_autoptr(GError) error = NULL;
+
+ if (!size)
+ return 0;
+
+ part = mm_sms_part_cdma_new_from_binary_pdu (0, data, size, NULL, &error);
+ g_assert (part || error);
+ return 0;
+}