summaryrefslogtreecommitdiff
path: root/src/mongo/bson/bson_validate_fuzzer.cpp
diff options
context:
space:
mode:
authorRoxane <roxane.fruytier@10gen.com>2019-06-24 11:03:16 -0400
committerRoxane <roxane.fruytier@10gen.com>2019-06-24 13:13:35 -0400
commit37f353a59fb7d3acb3dd583734022da7a77aa00a (patch)
tree1c46f0f64ed8a29ea63acbcc17a16a69271cc64a /src/mongo/bson/bson_validate_fuzzer.cpp
parent2d6e09e0fa8fe98f2bca109f6f9f20ff400de85b (diff)
downloadmongo-37f353a59fb7d3acb3dd583734022da7a77aa00a.tar.gz
SERVER-41705 Add BSON validator fuzzing test
Diffstat (limited to 'src/mongo/bson/bson_validate_fuzzer.cpp')
-rw-r--r--src/mongo/bson/bson_validate_fuzzer.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/mongo/bson/bson_validate_fuzzer.cpp b/src/mongo/bson/bson_validate_fuzzer.cpp
new file mode 100644
index 00000000000..5f3a33cb1b7
--- /dev/null
+++ b/src/mongo/bson/bson_validate_fuzzer.cpp
@@ -0,0 +1,35 @@
+/**
+ * Copyright (C) 2019-present MongoDB, Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the Server Side Public License, version 1,
+ * as published by MongoDB, Inc.
+ *
+ * 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
+ * Server Side Public License for more details.
+ *
+ * You should have received a copy of the Server Side Public License
+ * along with this program. If not, see
+ * <http://www.mongodb.com/licensing/server-side-public-license>.
+ *
+ * As a special exception, the copyright holders give permission to link the
+ * code of portions of this program with the OpenSSL library under certain
+ * conditions as described in each individual source file and distribute
+ * linked combinations including the program with the OpenSSL library. You
+ * must comply with the Server Side Public License in all respects for
+ * all of the code used other than as permitted herein. If you modify file(s)
+ * with this exception, you may extend this exception to your version of the
+ * file(s), but you are not obligated to do so. If you do not wish to do so,
+ * delete this exception statement from your version. If you delete this
+ * exception statement from all source files in the program, then also delete
+ * it in the license file.
+ */
+
+#include "mongo/bson/bson_validate.h"
+
+extern "C" int LLVMFuzzerTestOneInput(const char* Data, size_t Size) {
+ mongo::Status ret = mongo::validateBSON(Data, Size, mongo::BSONVersion::kLatest);
+ return 0;
+} \ No newline at end of file