Blame fuzz/gnutls_reverse_idna_parser_fuzzer.c
|
Packit Service |
4684c1 |
/*
|
|
Packit Service |
4684c1 |
# Copyright 2016 Nikos Mavrogiannopoulos
|
|
Packit Service |
4684c1 |
#
|
|
Packit Service |
4684c1 |
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
Packit Service |
4684c1 |
# you may not use this file except in compliance with the License.
|
|
Packit Service |
4684c1 |
# You may obtain a copy of the License at
|
|
Packit Service |
4684c1 |
#
|
|
Packit Service |
4684c1 |
# https://www.apache.org/licenses/LICENSE-2.0
|
|
Packit Service |
4684c1 |
#
|
|
Packit Service |
4684c1 |
# Unless required by applicable law or agreed to in writing, software
|
|
Packit Service |
4684c1 |
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
Packit Service |
4684c1 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
Packit Service |
4684c1 |
# See the License for the specific language governing permissions and
|
|
Packit Service |
4684c1 |
# limitations under the License.
|
|
Packit Service |
4684c1 |
#
|
|
Packit Service |
4684c1 |
################################################################################
|
|
Packit Service |
4684c1 |
*/
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
#include <assert.h>
|
|
Packit Service |
4684c1 |
#include <stdio.h>
|
|
Packit Service |
4684c1 |
#include <stdint.h>
|
|
Packit Service |
4684c1 |
#include <string.h>
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
#include <gnutls/gnutls.h>
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
#include "fuzzer.h"
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
|
|
Packit Service |
4684c1 |
{
|
|
Packit Service |
4684c1 |
gnutls_datum_t out;
|
|
Packit Service |
4684c1 |
int ret;
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
ret = gnutls_idna_reverse_map((char*)data, size, &out, 0);
|
|
Packit Service |
4684c1 |
if (ret < 0)
|
|
Packit Service |
4684c1 |
goto cleanup;
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
assert(out.size == strlen((char*)out.data));
|
|
Packit Service |
4684c1 |
gnutls_free(out.data);
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
cleanup:
|
|
Packit Service |
4684c1 |
return 0;
|
|
Packit Service |
4684c1 |
}
|