Skip to content
Snippets Groups Projects
Commit 67f8f70d authored by Sergey Bronnikov's avatar Sergey Bronnikov Committed by Igor Munkin
Browse files

test/fuzz: add fuzzing test for decoding decimals

NO_DOC=testing
NO_CHANGELOG=testing

(cherry picked from commit 4deadeb8)
parent 0d7edaa1
No related merge requests found
......@@ -133,6 +133,13 @@ if (NOT ENABLE_UB_SANITIZER)
LIBRARIES xrow fuzzer_config)
endif ()
# Blocked by https://github.com/tarantool/tarantool/issues/8948.
if (NOT ENABLE_UB_SANITIZER)
create_fuzz_test(PREFIX decimal_to_int64
SOURCES decimal_to_int64_fuzzer.c
LIBRARIES core fuzzer_config)
endif ()
include(ProtobufMutator)
# UndefinedBehaviorSanitizer is not supported in LuaJIT.
......
#include <string.h>
#include <stdlib.h>
#include "decimal.h"
#include "trivia/util.h"
int
LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{
char *buf = xcalloc(size + 1, sizeof(char));
if (!buf)
return 0;
memcpy(buf, data, size);
buf[size] = '\0';
decimal_t d;
decimal_from_string(&d, buf);
free(buf);
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