New fuzz/libpsl_load_fuzzer.c plus corpus directory

This commit is contained in:
Tim Rühsen 2017-06-14 09:49:07 +02:00
parent 6ca1304bd4
commit 666c07b364
198 changed files with 336 additions and 10 deletions

View File

@ -5,11 +5,13 @@ LDADD = ../src/libpsl.la
PSL_TESTS = \ PSL_TESTS = \
libpsl_fuzzer$(EXEEXT) \ libpsl_fuzzer$(EXEEXT) \
libpsl_load_fuzzer$(EXEEXT) \
libpsl_load_dafsa_fuzzer$(EXEEXT) libpsl_load_dafsa_fuzzer$(EXEEXT)
check_PROGRAMS = $(PSL_TESTS) check_PROGRAMS = $(PSL_TESTS)
libpsl_fuzzer_SOURCES = libpsl_fuzzer.c main.c fuzzer.h libpsl_fuzzer_SOURCES = libpsl_fuzzer.c main.c fuzzer.h
libpsl_load_fuzzer_SOURCES = libpsl_load_fuzzer.c main.c fuzzer.h
libpsl_load_dafsa_fuzzer_SOURCES = libpsl_load_dafsa_fuzzer.c main.c fuzzer.h libpsl_load_dafsa_fuzzer_SOURCES = libpsl_load_dafsa_fuzzer.c main.c fuzzer.h
dist-hook: dist-hook:

View File

@ -57,16 +57,6 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
psl_free(psl); psl_free(psl);
fclose(fp); fclose(fp);
// non-DAFSA load
fp = fmemopen(in + 16, size, "r");
if (!fp && size) // libc6 < 2.22 return NULL when size == 0
assert(1);
psl = psl_load_fp(fp);
psl_free(psl);
if (fp)
fclose(fp);
psl = psl_latest(NULL); psl = psl_latest(NULL);
psl_free(psl); psl_free(psl);

52
fuzz/libpsl_load_fuzzer.c Normal file
View File

@ -0,0 +1,52 @@
/*
* Copyright(c) 2017 Tim Ruehsen
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* This file is part of libpsl.
*/
#include <config.h>
#include <assert.h> // assert
#include <stdint.h> // uint8_t
#include <stdlib.h> // malloc, free
#include <string.h> // memcpy
#include "libpsl.h"
#include "fuzzer.h"
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{
psl_ctx_t *psl;
FILE *fp = fmemopen((void *)data, size, "r");
if (!fp && size) // libc6 < 2.22 return NULL when size == 0
assert(1);
psl = psl_load_fp(fp);
psl_is_public_suffix(NULL, NULL);
psl_is_public_suffix(psl, ".ü.com");
psl_free(psl);
if (fp)
fclose(fp);
return 0;
}

View File

@ -0,0 +1,9 @@
begin_icann="// ===BEGIN ICANN DOMAINS==="
end_icann="// ===END ICANN DOMAINS==="
begin_private="// ===BEGIN PRIVATE DOMAINS==="
end_private="// ===END PRIVATE DOMAINS==="
wildcard1="*.ck"
exception1="!www.ck"
wildcard2="*.kawasaki.jp"
exception1="!city.kawasaki.jp"
idn1="\xe5\x85\xac\xe5\x8f\xb8.cn"

View File

@ -0,0 +1 @@
<05>;

View File

@ -0,0 +1 @@
!c!city.kawasaki.jpk;*

View File

@ -0,0 +1,6 @@
™.jp
**.p
*.kŸwa¯;¸s
™.jp
*p.p
*awasaŸwa¯asaŸwa¯¸spS===;¸spS=

View File

@ -0,0 +1,6 @@
// ===BEGIN ICANN DOMAINS====AINS==Ÿ
// ===
//
// ===
// ==END

View File

@ -0,0 +1 @@
!ck公司.c!cn;

View File

@ -0,0 +1,2 @@
.DAFSA@PSL_ックsY
pcccccccccccccccccccccccccccccccccccccccccccccpi

View File

@ -0,0 +1,2 @@
..................ョ..............ョ

View File

@ -0,0 +1,4 @@
/=
/=!==
/=!pp===
/=!p===BEGIN D*.ckNS===!city.kawasaki.jp

View File

@ -0,0 +1,2 @@
!<21><>
// ===// =

View File

@ -0,0 +1,2 @@
;

View File

@ -0,0 +1,6 @@
.DAFSA@PSL_¯¸s;
™.jp
p*.pi
..jp
<EFBFBD>.
¸kp.Ÿšppi

View File

@ -0,0 +1,2 @@
// ===// ===BEGIN ICANN DOMAINS===;

View File

@ -0,0 +1,5 @@
.DAFSA@PSL_Ż¸s;
kźw˙˙˙˙˙˙˙˙˙˙aŻ;¸s
p.kźw

View File

@ -0,0 +1,5 @@
™.jp
*.p
*.kŸwa¯;¸s
™.jp
pawasaŸwa¯asaŸwa¯¸spS===;¸spS=

View File

@ -0,0 +1 @@
!ck公司.cn!www.ck;

View File

@ -0,0 +1,3 @@
// ==!p===BEGIN IC===BEGIN PRIVATE DOMAINS===Ÿ
// ===END===END

View File

@ -0,0 +1,3 @@
*.*.kawaü.compp
'公司.cnsakikawaü.compp
'a公司.cnsakinpp

View File

@ -0,0 +1 @@
:........ョ..............ョ

View File

@ -0,0 +1 @@
<EFBFBD>!ck

View File

@ -0,0 +1,5 @@
// ==!p=====BEGIN PRIVATE DOMAINS=====Ÿ
// ===
// ===
// ==END

View File

@ -0,0 +1,3 @@
pppppp
'™;*.kawasaki.jp
™*pppVVVV<56><56>pppå;…¬å<C2AC>¸,cnpp

View File

@ -0,0 +1 @@
!<21>.<2E>cn;

View File

@ -0,0 +1,8 @@
;å*å.Ÿ…k¬wa
™.jp¯¸s;
™.jp
p..jp¯¸s;
™.jp
p.¸s
™.j.p
p<EFBFBD>¸.pk

View File

@ -0,0 +1 @@
!ck;

View File

@ -0,0 +1,4 @@
// ==!p=====BEGIN PRIVATE DOMAINS=====Ÿ
// ===
// ===UND===END

View File

@ -0,0 +1,2 @@
.DAFSA@PSL_¯¸s;
™;

Some files were not shown because too many files have changed in this diff Show More