Skip to content
Snippets Groups Projects
Commit fd0c5d85 authored by Alexey Vishnyakov's avatar Alexey Vishnyakov Committed by Kirill Yukhin
Browse files

test: Add swim proto fuzz targets.

parent ee94aa69
No related branches found
No related tags found
No related merge requests found
......@@ -38,8 +38,16 @@ target_link_libraries(uri_fuzzer PUBLIC uri fuzzer_config)
add_executable(http_parser_fuzzer http_parser_fuzzer.c)
target_link_libraries(http_parser_fuzzer PUBLIC http_parser fuzzer_config)
add_executable(swim_proto_member_fuzzer swim_proto_member_fuzzer.c)
target_link_libraries(swim_proto_member_fuzzer PUBLIC swim fuzzer_config)
add_executable(swim_proto_meta_fuzzer swim_proto_meta_fuzzer.c)
target_link_libraries(swim_proto_meta_fuzzer PUBLIC swim fuzzer_config)
set(fuzzing_binaries csv_fuzzer
http_parser_fuzzer
swim_proto_member_fuzzer
swim_proto_meta_fuzzer
uri_fuzzer)
add_custom_target(fuzzers
......
// Copyright 2021 ISP RAS
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////////
#include <stdint.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include "swim/swim_proto.h"
#include "fiber.h"
#include "memory.h"
uint32_t
tarantool_version_id()
{
return 1;
}
void cord_on_yield() {}
int
LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{
memory_init();
fiber_init(fiber_c_invoke);
struct swim_member_def def;
const char *pos = (const char *)data;
swim_member_def_decode(&def, &pos, pos + size, "");
fiber_free();
memory_free();
return 0;
}
// Copyright 2021 ISP RAS
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////////
#include <stdint.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include "swim/swim_proto.h"
#include "fiber.h"
#include "memory.h"
uint32_t
tarantool_version_id()
{
return 1;
}
void cord_on_yield() {}
int
LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{
memory_init();
fiber_init(fiber_c_invoke);
struct swim_meta_def def;
const char *pos = (const char *)data;
swim_meta_def_decode(&def, &pos, pos + size);
fiber_free();
memory_free();
return 0;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment