Skip to content
This repository was archived by the owner on Oct 31, 2023. It is now read-only.

Commit d75af10

Browse files
committed
SERVER-41704 adding asn1 libfuzzer parser
1 parent 09e1455 commit d75af10

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

src/mongo/util/net/SConscript

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,17 @@ env.CppUnitTest(
205205
],
206206
)
207207

208+
env.CppLibfuzzerTest(
209+
target='asn1_parser_fuzzer',
210+
source=[
211+
'asn1_parser_fuzzer.cpp',
212+
],
213+
LIBDEPS=[
214+
'$BUILD_DIR/mongo/base',
215+
'$BUILD_DIR/mongo/util/net/ssl_manager',
216+
],
217+
)
218+
208219
if get_option('ssl') == 'on':
209220
env.CppUnitTest(
210221
target='util_net_ssl_test',
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/**
2+
* Copyright (C) 2019-present MongoDB, Inc.
3+
*
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the Server Side Public License, version 1,
6+
* as published by MongoDB, Inc.
7+
*
8+
* This program is distributed in the hope that it will be useful,
9+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
* Server Side Public License for more details.
12+
*
13+
* You should have received a copy of the Server Side Public License
14+
* along with this program. If not, see
15+
* <http://www.mongodb.com/licensing/server-side-public-license>.
16+
*
17+
* As a special exception, the copyright holders give permission to link the
18+
* code of portions of this program with the OpenSSL library under certain
19+
* conditions as described in each individual source file and distribute
20+
* linked combinations including the program with the OpenSSL library. You
21+
* must comply with the Server Side Public License in all respects for
22+
* all of the code used other than as permitted herein. If you modify file(s)
23+
* with this exception, you may extend this exception to your version of the
24+
* file(s), but you are not obligated to do so. If you do not wish to do so,
25+
* delete this exception statement from your version. If you delete this
26+
* exception statement from all source files in the program, then also delete
27+
* it in the license file.
28+
*/
29+
30+
#include "mongo/base/data_range.h"
31+
#include "mongo/util/net/ssl_manager.h"
32+
33+
extern "C" int LLVMFuzzerTestOneInput(const char* Data, size_t Size) {
34+
mongo::ConstDataRange dr = mongo::ConstDataRange(Data, Size);
35+
auto ret = mongo::parsePeerRoles(dr);
36+
return 0;
37+
}

0 commit comments

Comments
 (0)