mirror of
https://github.com/mirror/wget.git
synced 2024-12-28 22:00:27 +08:00
Add new fuzzer for the URL parser
* fuzz/Makefile.am: Add wget_url_fuzzer * fuzz/wget_url_fuzzer.c: New fuzzer * fuzz/wget_url_fuzzer.in: Initial corpora
This commit is contained in:
parent
93e5a97f25
commit
02325168ca
@ -13,7 +13,8 @@ WGET_TESTS = \
|
||||
wget_ftpls_fuzzer$(EXEEXT) \
|
||||
wget_html_fuzzer$(EXEEXT) \
|
||||
wget_options_fuzzer$(EXEEXT) \
|
||||
wget_robots_fuzzer$(EXEEXT)
|
||||
wget_robots_fuzzer$(EXEEXT) \
|
||||
wget_url_fuzzer$(EXEEXT)
|
||||
|
||||
if FUZZING
|
||||
bin_PROGRAMS = $(WGET_TESTS)
|
||||
@ -48,6 +49,9 @@ wget_options_fuzzer_LDADD = ../src/libunittest.a $(LDADD)
|
||||
wget_robots_fuzzer_SOURCES = wget_robots_fuzzer.c $(MAIN)
|
||||
wget_robots_fuzzer_LDADD = ../src/libunittest.a $(LDADD)
|
||||
|
||||
wget_url_fuzzer_SOURCES = wget_url_fuzzer.c $(MAIN)
|
||||
wget_url_fuzzer_LDADD = ../src/libunittest.a $(LDADD)
|
||||
|
||||
#EXTRA_DIST = $(wildcard *.options) $(wildcard *.dict) \
|
||||
# $(wildcard *.in) $(wildcard *.repro)
|
||||
|
||||
|
110
fuzz/wget_url_fuzzer.c
Normal file
110
fuzz/wget_url_fuzzer.c
Normal file
@ -0,0 +1,110 @@
|
||||
/*
|
||||
* Copyright(c) 2017-2018 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of GNU Wget.
|
||||
*
|
||||
* GNU Wget is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GNU Wget is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Wget. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h> // uint8_t
|
||||
#include <stdio.h> // fmemopen
|
||||
#include <string.h> // strncmp
|
||||
#include <stdlib.h> // free
|
||||
#include <unistd.h> // close
|
||||
|
||||
#include "wget.h"
|
||||
#undef fopen_wgetrc
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#include "url.h"
|
||||
|
||||
// declarations for wget internal functions
|
||||
int main_wget(int argc, const char **argv);
|
||||
void cleanup(void);
|
||||
FILE *fopen_wget(const char *pathname, const char *mode);
|
||||
FILE *fopen_wgetrc(const char *pathname, const char *mode);
|
||||
void exit_wget(int status);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#include "fuzzer.h"
|
||||
|
||||
FILE *fopen_wget(const char *pathname, const char *mode)
|
||||
{
|
||||
return fopen("/dev/null", mode);
|
||||
}
|
||||
|
||||
FILE *fopen_wgetrc(const char *pathname, const char *mode)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef FUZZING
|
||||
void exit_wget(int status)
|
||||
{
|
||||
}
|
||||
#else
|
||||
void exit(int status)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
|
||||
{
|
||||
FILE *bak;
|
||||
struct url *url;
|
||||
struct iri iri;
|
||||
char *in;
|
||||
|
||||
if (size > 4096) // same as max_len = ... in .options file
|
||||
return 0;
|
||||
|
||||
bak = stderr;
|
||||
stderr = fopen("/dev/null", "w");
|
||||
|
||||
in = (char *) malloc(size + 1);
|
||||
memcpy(in, data, size);
|
||||
in[size] = 0;
|
||||
|
||||
iri.uri_encoding = (char *) "iso-8859-1";
|
||||
iri.orig_url = NULL;
|
||||
|
||||
iri.utf8_encode = 0;
|
||||
url = url_parse(in, NULL, &iri, 0);
|
||||
url_free(url);
|
||||
|
||||
url = url_parse(in, NULL, &iri, 1);
|
||||
url_free(url);
|
||||
|
||||
iri.utf8_encode = 1;
|
||||
url = url_parse(in, NULL, &iri, 0);
|
||||
url_free(url);
|
||||
|
||||
url = url_parse(in, NULL, &iri, 1);
|
||||
url_free(url);
|
||||
|
||||
free(iri.orig_url);
|
||||
free(in);
|
||||
|
||||
fclose(stderr);
|
||||
stderr = bak;
|
||||
|
||||
return 0;
|
||||
}
|
@ -0,0 +1 @@
|
||||
httpS://ц<><D186><EFBFBD>
|
@ -0,0 +1 @@
|
||||
http://aXX
|
@ -0,0 +1 @@
|
||||
hxiyelNNFNNNNNCyelNNFº±NNNNN666
|
@ -0,0 +1 @@
|
||||
hWWWWWWWWWWW
|
@ -0,0 +1 @@
|
||||
Waliaトf
|
@ -0,0 +1 @@
|
||||
http://<2F>%<<<<<%<04>
|
@ -0,0 +1 @@
|
||||
dddd
|
BIN
fuzz/wget_url_fuzzer.in/0180d95872d8d563942403fb3effaa3c6df01a1f
Normal file
BIN
fuzz/wget_url_fuzzer.in/0180d95872d8d563942403fb3effaa3c6df01a1f
Normal file
Binary file not shown.
@ -0,0 +1 @@
|
||||
http://a8b@x.yzÌ0/di&&&&&ir/f
|
BIN
fuzz/wget_url_fuzzer.in/01cc5a7ae113f4768c8ff8ad94c78a7c2858be4f
Normal file
BIN
fuzz/wget_url_fuzzer.in/01cc5a7ae113f4768c8ff8ad94c78a7c2858be4f
Normal file
Binary file not shown.
@ -0,0 +1 @@
|
||||
httgtphtgh
|
@ -0,0 +1 @@
|
||||
http://a>://a:b@:b@x.y:2%%de««SS.%e§=°¹val'f¡
|
@ -0,0 +1 @@
|
||||
ccccccccc/di
|
@ -0,0 +1 @@
|
||||
http://iehl
|
@ -0,0 +1,3 @@
|
||||
http://http:/¯a:b@x.%%%%%%66%6%66666600000#f
|
||||
r/3f
|
||||
r/fval'f
|
@ -0,0 +1 @@
|
||||
ftp://[b::]p
|
@ -0,0 +1 @@
|
||||
LpJ
|
@ -0,0 +1 @@
|
||||
hI22222222222222222222222222222222
|
@ -0,0 +1 @@
|
||||
Hhe686>
|
@ -0,0 +1 @@
|
||||
hSt5ctypeIcESt5ctypIcE.yz#f
|
@ -0,0 +1 @@
|
||||
http://http://a:b@x.yz80/diÂ<69>ÂÂÂ<C382><C382><EFBFBD>%00000000000000000000000000000000...%%%%%%%%%%%%%%%%00000;00000000000000000val&keSSSl'f
|
@ -0,0 +1 @@
|
||||
RRf
|
@ -0,0 +1 @@
|
||||
http://aェェェttttttttttttttt%%%%%%%%nnnnnnnnnnnnnn
|
@ -0,0 +1 @@
|
||||
http://aX%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
@ -0,0 +1 @@
|
||||
http://a:b@
|
@ -0,0 +1 @@
|
||||
iQ
|
@ -0,0 +1 @@
|
||||
http://<<<<<<<<<<<k
|
@ -0,0 +1 @@
|
||||
333232
|
BIN
fuzz/wget_url_fuzzer.in/089c35e40f45844ff39c95d143d152dcc8b0852b
Normal file
BIN
fuzz/wget_url_fuzzer.in/089c35e40f45844ff39c95d143d152dcc8b0852b
Normal file
Binary file not shown.
@ -0,0 +1 @@
|
||||
http://[0.]
|
BIN
fuzz/wget_url_fuzzer.in/0973d11ec5722a9b6741d0a8c33be95698bf0907
Normal file
BIN
fuzz/wget_url_fuzzer.in/0973d11ec5722a9b6741d0a8c33be95698bf0907
Normal file
Binary file not shown.
@ -0,0 +1 @@
|
||||
hF0
|
@ -0,0 +1 @@
|
||||
rrrdrrd:
|
@ -0,0 +1 @@
|
||||
gBggggggggyyyyyyyyg尨
|
@ -0,0 +1 @@
|
||||
hxiek7yel116842684
|
BIN
fuzz/wget_url_fuzzer.in/0b07e41eebbc9c4ce27c6d8d96f0774956b442bc
Normal file
BIN
fuzz/wget_url_fuzzer.in/0b07e41eebbc9c4ce27c6d8d96f0774956b442bc
Normal file
Binary file not shown.
@ -0,0 +1 @@
|
||||
http://a8:b@0</dir‰‰‰‰‰‰‰‰‰‰‰‰‰:/1=val
|
BIN
fuzz/wget_url_fuzzer.in/0b7e9c3807dc011f2d2cc5408497e8559d7e5627
Normal file
BIN
fuzz/wget_url_fuzzer.in/0b7e9c3807dc011f2d2cc5408497e8559d7e5627
Normal file
Binary file not shown.
BIN
fuzz/wget_url_fuzzer.in/0c041a2ee8f7a742e5bfeda6b120544756170aff
Normal file
BIN
fuzz/wget_url_fuzzer.in/0c041a2ee8f7a742e5bfeda6b120544756170aff
Normal file
Binary file not shown.
@ -0,0 +1,2 @@
|
||||
http://http:/:b@ВЌ%%%%%%%Ь%%%%%%%%%%%%%http://aЄЄЄЄЄЄЄЄЄЄЄЄЄЄЄЄЄЄЄЄЄЄЄЄЄЄЄЄЄЄЄЄ(ЄЄЄЄЄЄЄЄЄ66666667;000000000000В%%%%%%%%%%%%%%%%%%%%%%66666666666666'f
|
||||
7;000000000000В%%%%%%%%%%%%%%%%%%%%%6%6666666666666'f
|
@ -0,0 +1 @@
|
||||
http://a‘://a:b@x.y:80/di8....../.../.././0/dir/fh
|
@ -0,0 +1 @@
|
||||
hxel00000NNNooooÆN66
|
@ -0,0 +1 @@
|
||||
htkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk/Fil
|
@ -0,0 +1 @@
|
||||
http://[BBB:BBBBB]
|
@ -0,0 +1 @@
|
||||
http://acbキャャャャャ;ャb<EFBDAC>キャム<EFBDAC>ャャャャャャャャャャャャャャャ'
|
@ -0,0 +1 @@
|
||||
http://ÿee=j
|
@ -0,0 +1 @@
|
||||
http://<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><15><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
@ -0,0 +1 @@
|
||||
3332BBBB
|
@ -0,0 +1 @@
|
||||
http://Õ./.0/d//../.......0/d..........0/d//../.......0/di8.....il..e.x?keir/file.x?key=ee=kxval&key2=val#f
|
@ -0,0 +1 @@
|
||||
ftp://ホ:%33;
|
@ -0,0 +1 @@
|
||||
http://[5555b]
|
@ -0,0 +1 @@
|
||||
http://a:b@uŠŠÿÿÿÿÿÿÿ%%%.ŠŠ3=val#f
|
@ -0,0 +1 @@
|
||||
hEEEEEEEE
|
@ -0,0 +1 @@
|
||||
http://a:bÓ@’цÅǶr/f.6
|
@ -0,0 +1 @@
|
||||
http://a:b@x.ŠŠŠŠŠŠŠŠŠŠŠŠŠht://../.....<2E>Š..ŠŠŠŠŠŠ
|
BIN
fuzz/wget_url_fuzzer.in/11aa6e50736b9430f0996c3c550b9592bb5cd40f
Normal file
BIN
fuzz/wget_url_fuzzer.in/11aa6e50736b9430f0996c3c550b9592bb5cd40f
Normal file
Binary file not shown.
BIN
fuzz/wget_url_fuzzer.in/11b2e583b25f6e289b1335750f0407eca5d4b20b
Normal file
BIN
fuzz/wget_url_fuzzer.in/11b2e583b25f6e289b1335750f0407eca5d4b20b
Normal file
Binary file not shown.
@ -0,0 +1 @@
|
||||
http://öap://::::::!:::::::::::::Ú:::˙˙˙˙::::.ebbbbbb&key2=val#f
|
BIN
fuzz/wget_url_fuzzer.in/12bff6b6c8a63e54e8bfeec2376bbf382a0252cf
Normal file
BIN
fuzz/wget_url_fuzzer.in/12bff6b6c8a63e54e8bfeec2376bbf382a0252cf
Normal file
Binary file not shown.
@ -0,0 +1 @@
|
||||
hIIII7777777777777777777777777777777777777777777777777htQQQQQQQQ#f
|
@ -0,0 +1 @@
|
||||
http://a<>:b@x.<2E><>
<0A><><EFBFBD><EFBFBD><EFBFBD>%%
|
@ -0,0 +1 @@
|
||||
http://[%301.]
|
@ -0,0 +1 @@
|
||||
http://a:b@x%%%%<<<<<k1=val#f
|
@ -0,0 +1 @@
|
||||
OO
|
@ -0,0 +1 @@
|
||||
Kbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb郹<13>
|
BIN
fuzz/wget_url_fuzzer.in/164d9cdd6ea19be417caf6111d517c323299b81d
Normal file
BIN
fuzz/wget_url_fuzzer.in/164d9cdd6ea19be417caf6111d517c323299b81d
Normal file
Binary file not shown.
@ -0,0 +1 @@
|
||||
http://h/
|
@ -0,0 +1 @@
|
||||
http://<18>
|
@ -0,0 +1 @@
|
||||
http://[%33::]ス
|
@ -0,0 +1 @@
|
||||
http://a:b@xal&k\\\\\\\\\\\\\\\\\\\¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾\\\\\\\\ey2http://a:bx@.yz80/di80/dhttp://ap:)//a:b@x.y:80
|
@ -0,0 +1 @@
|
||||
ftp://<2F>;
|
@ -0,0 +1 @@
|
||||
http://ape~~)eeeeeeeee%eeeeege
|
BIN
fuzz/wget_url_fuzzer.in/18866b9f74743b9b16cb73c9a12445c329f9e183
Normal file
BIN
fuzz/wget_url_fuzzer.in/18866b9f74743b9b16cb73c9a12445c329f9e183
Normal file
Binary file not shown.
@ -0,0 +1 @@
|
||||
httpS://.
|
@ -0,0 +1 @@
|
||||
http://a‘:/............/.././...../.././....dir=
|
@ -0,0 +1 @@
|
||||
Hh
|
@ -0,0 +1 @@
|
||||
ftp://%3a:%32
|
BIN
fuzz/wget_url_fuzzer.in/19e696a558167899329bdcbdc10173fcdfe16c86
Normal file
BIN
fuzz/wget_url_fuzzer.in/19e696a558167899329bdcbdc10173fcdfe16c86
Normal file
Binary file not shown.
BIN
fuzz/wget_url_fuzzer.in/1a3eaf0d0049da9dc2f1330ceed48055c40034a0
Normal file
BIN
fuzz/wget_url_fuzzer.in/1a3eaf0d0049da9dc2f1330ceed48055c40034a0
Normal file
Binary file not shown.
@ -0,0 +1 @@
|
||||
Irzrrrrrz」tp:/ャャ;
|
@ -0,0 +1 @@
|
||||
ww
|
@ -0,0 +1 @@
|
||||
hMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMy0=
|
@ -0,0 +1 @@
|
||||
ht6666000000000000000000060000000000000106:2341val#f
|
@ -0,0 +1 @@
|
||||
4<EFBFBD>
|
@ -0,0 +1 @@
|
||||
hTtTt
|
@ -0,0 +1 @@
|
||||
htklLllllllli
|
@ -0,0 +1 @@
|
||||
http://httpyyyyyyyy˙:0000000000000000000000000000000000aź
|
@ -0,0 +1 @@
|
||||
http://key=vax
|
@ -0,0 +1 @@
|
||||
http://ム末末;蘭
|
@ -0,0 +1 @@
|
||||
http://a:b@=val#ÿÿÿÿy3=va:l#ÿÿÿÿf
|
BIN
fuzz/wget_url_fuzzer.in/1fc1e02aed8f5b559a4baf790e03bfb0e5884b59
Normal file
BIN
fuzz/wget_url_fuzzer.in/1fc1e02aed8f5b559a4baf790e03bfb0e5884b59
Normal file
Binary file not shown.
@ -0,0 +1 @@
|
||||
hVmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmml
|
@ -0,0 +1 @@
|
||||
77777777III#f
|
@ -0,0 +1 @@
|
||||
httKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKp:/q#f
|
@ -0,0 +1 @@
|
||||
httLLxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx#f
|
@ -0,0 +1 @@
|
||||
http://ÿÿÿÿpa:960/al
|
@ -0,0 +1 @@
|
||||
http://%3a
|
@ -0,0 +1,2 @@
|
||||
http://a:b@x.yz80È›–ÇÏЛìf
|
||||
r/file.x?key=val&key2=va:l#f
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user