diff --git a/fuzz/Makefile.am b/fuzz/Makefile.am
index 199fe267..118bafa8 100644
--- a/fuzz/Makefile.am
+++ b/fuzz/Makefile.am
@@ -10,6 +10,7 @@ LDADD = ../lib/libgnu.a \
WGET_TESTS = \
wget_css_fuzzer$(EXEEXT) \
+ wget_html_fuzzer$(EXEEXT) \
wget_options_fuzzer$(EXEEXT)
if FUZZING
@@ -33,6 +34,9 @@ endif
wget_css_fuzzer_SOURCES = wget_css_fuzzer.c $(MAIN)
wget_css_fuzzer_LDADD = ../src/libunittest.a $(LDADD)
+wget_html_fuzzer_SOURCES = wget_html_fuzzer.c $(MAIN)
+wget_html_fuzzer_LDADD = ../src/libunittest.a $(LDADD)
+
wget_options_fuzzer_SOURCES = wget_options_fuzzer.c $(MAIN)
wget_options_fuzzer_LDADD = ../src/libunittest.a $(LDADD)
diff --git a/fuzz/wget_html_fuzzer.c b/fuzz/wget_html_fuzzer.c
new file mode 100644
index 00000000..1e262a16
--- /dev/null
+++ b/fuzz/wget_html_fuzzer.c
@@ -0,0 +1,102 @@
+/*
+ * 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 .
+ */
+
+#include
+
+#include
+#include // opendir, readdir
+#include // uint8_t
+#include // fmemopen
+#include // strncmp
+#include // free
+#include // open flags
+#include // close
+#include // longjmp, setjmp
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+ #include "utils.h"
+ #include "html-url.h"
+ #include "css-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"
+
+static const uint8_t *g_data;
+static size_t g_size;
+
+FILE *fopen_wget(const char *pathname, const char *mode)
+{
+ return fopen("/dev/null", mode);
+}
+
+#undef fopen_wgetrc
+FILE *fopen_wgetrc(const char *pathname, const char *mode)
+{
+#ifdef HAVE_FMEMOPEN
+ return fmemopen((void *) g_data, g_size, mode);
+#else
+ return NULL;
+#endif
+}
+
+#ifdef FUZZING
+void exit_wget(int status)
+{
+}
+#else
+void exit(int status)
+{
+}
+#endif
+
+int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
+{
+ struct urlpos *urls;
+ struct file_memory fm;
+ FILE *bak;
+
+ if (size > 4096) // same as max_len = ... in .options file
+ return 0;
+
+ bak = stderr;
+ stderr = fopen("/dev/null", "w");
+
+ fm.content = (char *) data;
+ fm.length = size;
+ fm.mmap_p = 0;
+
+ urls = get_urls_html_fm("xxx", &fm, "https://x.y", NULL, NULL);
+ free_urlpos(urls);
+
+ fclose(stderr);
+ stderr = bak;
+
+ return 0;
+}
diff --git a/fuzz/wget_html_fuzzer.dict b/fuzz/wget_html_fuzzer.dict
new file mode 100644
index 00000000..b56efc08
--- /dev/null
+++ b/fuzz/wget_html_fuzzer.dict
@@ -0,0 +1,22 @@
+">
\ No newline at end of file
diff --git a/fuzz/wget_html_fuzzer.in/022082778cce79b4eee47e504da4d6dd12248d47 b/fuzz/wget_html_fuzzer.in/022082778cce79b4eee47e504da4d6dd12248d47
new file mode 100644
index 00000000..9950e589
Binary files /dev/null and b/fuzz/wget_html_fuzzer.in/022082778cce79b4eee47e504da4d6dd12248d47 differ
diff --git a/fuzz/wget_html_fuzzer.in/0224b47db70aaf7b5708612e05827fdb9d559465 b/fuzz/wget_html_fuzzer.in/0224b47db70aaf7b5708612e05827fdb9d559465
new file mode 100644
index 00000000..b90bd647
--- /dev/null
+++ b/fuzz/wget_html_fuzzer.in/0224b47db70aaf7b5708612e05827fdb9d559465
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/fuzz/wget_html_fuzzer.in/0b5da4686bb809ab3a13a88a81871bada6a6f2b0 b/fuzz/wget_html_fuzzer.in/0b5da4686bb809ab3a13a88a81871bada6a6f2b0
new file mode 100644
index 00000000..9fc21d58
Binary files /dev/null and b/fuzz/wget_html_fuzzer.in/0b5da4686bb809ab3a13a88a81871bada6a6f2b0 differ
diff --git a/fuzz/wget_html_fuzzer.in/0b661d2a6cb68c14416b63323df26cc5ac6f92f7 b/fuzz/wget_html_fuzzer.in/0b661d2a6cb68c14416b63323df26cc5ac6f92f7
new file mode 100644
index 00000000..b57795dc
Binary files /dev/null and b/fuzz/wget_html_fuzzer.in/0b661d2a6cb68c14416b63323df26cc5ac6f92f7 differ
diff --git a/fuzz/wget_html_fuzzer.in/0b70f64662b3fa0d1a6d77c8e78a658d4d2b8724 b/fuzz/wget_html_fuzzer.in/0b70f64662b3fa0d1a6d77c8e78a658d4d2b8724
new file mode 100644
index 00000000..8c6282f2
Binary files /dev/null and b/fuzz/wget_html_fuzzer.in/0b70f64662b3fa0d1a6d77c8e78a658d4d2b8724 differ
diff --git a/fuzz/wget_html_fuzzer.in/0b869db1888b8d8e14182130c7971942018e07ce b/fuzz/wget_html_fuzzer.in/0b869db1888b8d8e14182130c7971942018e07ce
new file mode 100644
index 00000000..49c2fbc6
Binary files /dev/null and b/fuzz/wget_html_fuzzer.in/0b869db1888b8d8e14182130c7971942018e07ce differ
diff --git a/fuzz/wget_html_fuzzer.in/0ba12ba390adf55225b9c6db7d751e0af2173c8b b/fuzz/wget_html_fuzzer.in/0ba12ba390adf55225b9c6db7d751e0af2173c8b
new file mode 100644
index 00000000..640fef63
Binary files /dev/null and b/fuzz/wget_html_fuzzer.in/0ba12ba390adf55225b9c6db7d751e0af2173c8b differ
diff --git a/fuzz/wget_html_fuzzer.in/0ba24e4c9cdb6f30a352efe957e6c844066e3757 b/fuzz/wget_html_fuzzer.in/0ba24e4c9cdb6f30a352efe957e6c844066e3757
new file mode 100644
index 00000000..3f225f7d
Binary files /dev/null and b/fuzz/wget_html_fuzzer.in/0ba24e4c9cdb6f30a352efe957e6c844066e3757 differ
diff --git a/fuzz/wget_html_fuzzer.in/0baa03a574b3f7f7f62856e4892bdc48a9061b25 b/fuzz/wget_html_fuzzer.in/0baa03a574b3f7f7f62856e4892bdc48a9061b25
new file mode 100644
index 00000000..ba78cb12
--- /dev/null
+++ b/fuzz/wget_html_fuzzer.in/0baa03a574b3f7f7f62856e4892bdc48a9061b25
@@ -0,0 +1 @@
+ â–<```` rel='stylesheÎ@@@@XXX
\ No newline at end of file
diff --git a/fuzz/wget_html_fuzzer.in/1132934737dca73ca15930e55122dc34f3b457f2 b/fuzz/wget_html_fuzzer.in/1132934737dca73ca15930e55122dc34f3b457f2
new file mode 100644
index 00000000..e1cdddaf
--- /dev/null
+++ b/fuzz/wget_html_fuzzer.in/1132934737dca73ca15930e55122dc34f3b457f2
@@ -0,0 +1 @@
+ (( ((
\ No newline at end of file
diff --git a/fuzz/wget_html_fuzzer.in/1bc58baf159baae53bb31b2de475d0a6b9d1dade b/fuzz/wget_html_fuzzer.in/1bc58baf159baae53bb31b2de475d0a6b9d1dade
new file mode 100644
index 00000000..8d4a56c5
--- /dev/null
+++ b/fuzz/wget_html_fuzzer.in/1bc58baf159baae53bb31b2de475d0a6b9d1dade
@@ -0,0 +1,2 @@
+ow"IImeta
\ No newline at end of file
diff --git a/fuzz/wget_html_fuzzer.in/1de503a412494254479e88ec90118c9925507a81 b/fuzz/wget_html_fuzzer.in/1de503a412494254479e88ec90118c9925507a81
new file mode 100644
index 00000000..3f3e48b7
--- /dev/null
+++ b/fuzz/wget_html_fuzzer.in/1de503a412494254479e88ec90118c9925507a81
@@ -0,0 +1,2 @@
+bn//
ate
\ No newline at end of file
diff --git a/fuzz/wget_html_fuzzer.in/4108eeb8181731d76cd18f0b8390b6b87083719a b/fuzz/wget_html_fuzzer.in/4108eeb8181731d76cd18f0b8390b6b87083719a
new file mode 100644
index 00000000..7913626e
Binary files /dev/null and b/fuzz/wget_html_fuzzer.in/4108eeb8181731d76cd18f0b8390b6b87083719a differ
diff --git a/fuzz/wget_html_fuzzer.in/412ccfa5ca81baed9c85fc26735dadccaf8d77f5 b/fuzz/wget_html_fuzzer.in/412ccfa5ca81baed9c85fc26735dadccaf8d77f5
new file mode 100644
index 00000000..7369b84f
Binary files /dev/null and b/fuzz/wget_html_fuzzer.in/412ccfa5ca81baed9c85fc26735dadccaf8d77f5 differ
diff --git a/fuzz/wget_html_fuzzer.in/41305d373ea24aad4c6c1e9edfd1ec07ed0a03b5 b/fuzz/wget_html_fuzzer.in/41305d373ea24aad4c6c1e9edfd1ec07ed0a03b5
new file mode 100644
index 00000000..6a45f9ca
Binary files /dev/null and b/fuzz/wget_html_fuzzer.in/41305d373ea24aad4c6c1e9edfd1ec07ed0a03b5 differ
diff --git a/fuzz/wget_html_fuzzer.in/415ce5c99b7906426bb52de6a27ac7208c13d478 b/fuzz/wget_html_fuzzer.in/415ce5c99b7906426bb52de6a27ac7208c13d478
new file mode 100644
index 00000000..b630b90b
Binary files /dev/null and b/fuzz/wget_html_fuzzer.in/415ce5c99b7906426bb52de6a27ac7208c13d478 differ
diff --git a/fuzz/wget_html_fuzzer.in/41640979f75a6a729fcab95ae23213705d0f078f b/fuzz/wget_html_fuzzer.in/41640979f75a6a729fcab95ae23213705d0f078f
new file mode 100644
index 00000000..aeb0a773
Binary files /dev/null and b/fuzz/wget_html_fuzzer.in/41640979f75a6a729fcab95ae23213705d0f078f differ
diff --git a/fuzz/wget_html_fuzzer.in/416d8a0d5cef9904937efe32941d9ab0b89aef47 b/fuzz/wget_html_fuzzer.in/416d8a0d5cef9904937efe32941d9ab0b89aef47
new file mode 100644
index 00000000..d5d235b6
Binary files /dev/null and b/fuzz/wget_html_fuzzer.in/416d8a0d5cef9904937efe32941d9ab0b89aef47 differ
diff --git a/fuzz/wget_html_fuzzer.in/4176155e3f087d07735539c3954442884ad7f34a b/fuzz/wget_html_fuzzer.in/4176155e3f087d07735539c3954442884ad7f34a
new file mode 100644
index 00000000..70d6f5f9
Binary files /dev/null and b/fuzz/wget_html_fuzzer.in/4176155e3f087d07735539c3954442884ad7f34a differ
diff --git a/fuzz/wget_html_fuzzer.in/417a5706a397c90ccedf25a15a766ca591e27c3f b/fuzz/wget_html_fuzzer.in/417a5706a397c90ccedf25a15a766ca591e27c3f
new file mode 100644
index 00000000..eb1228b3
Binary files /dev/null and b/fuzz/wget_html_fuzzer.in/417a5706a397c90ccedf25a15a766ca591e27c3f differ
diff --git a/fuzz/wget_html_fuzzer.in/41867e264be9c97056a8c83d4f195af19d90e3cc b/fuzz/wget_html_fuzzer.in/41867e264be9c97056a8c83d4f195af19d90e3cc
new file mode 100644
index 00000000..f8fe3210
Binary files /dev/null and b/fuzz/wget_html_fuzzer.in/41867e264be9c97056a8c83d4f195af19d90e3cc differ
diff --git a/fuzz/wget_html_fuzzer.in/4192cade24ccda6d99352450597ccd5d8201daf6 b/fuzz/wget_html_fuzzer.in/4192cade24ccda6d99352450597ccd5d8201daf6
new file mode 100644
index 00000000..3a4c192b
Binary files /dev/null and b/fuzz/wget_html_fuzzer.in/4192cade24ccda6d99352450597ccd5d8201daf6 differ
diff --git a/fuzz/wget_html_fuzzer.in/41b876ebc86b1db99e10cfcff683513c1f9b5e66 b/fuzz/wget_html_fuzzer.in/41b876ebc86b1db99e10cfcff683513c1f9b5e66
new file mode 100644
index 00000000..4c2908a1
Binary files /dev/null and b/fuzz/wget_html_fuzzer.in/41b876ebc86b1db99e10cfcff683513c1f9b5e66 differ
diff --git a/fuzz/wget_html_fuzzer.in/41f20142b576966c6aeaa8eefd2cad59e324394e b/fuzz/wget_html_fuzzer.in/41f20142b576966c6aeaa8eefd2cad59e324394e
new file mode 100644
index 00000000..1e30c305
Binary files /dev/null and b/fuzz/wget_html_fuzzer.in/41f20142b576966c6aeaa8eefd2cad59e324394e differ
diff --git a/fuzz/wget_html_fuzzer.in/4208ebb8b91c641e68e27468b34fc643bd9f7434 b/fuzz/wget_html_fuzzer.in/4208ebb8b91c641e68e27468b34fc643bd9f7434
new file mode 100644
index 00000000..8cedb1d8
Binary files /dev/null and b/fuzz/wget_html_fuzzer.in/4208ebb8b91c641e68e27468b34fc643bd9f7434 differ
diff --git a/fuzz/wget_html_fuzzer.in/423df4803f117c6b19ac0a5ff4d9367f9b72da52 b/fuzz/wget_html_fuzzer.in/423df4803f117c6b19ac0a5ff4d9367f9b72da52
new file mode 100644
index 00000000..905ee1c7
Binary files /dev/null and b/fuzz/wget_html_fuzzer.in/423df4803f117c6b19ac0a5ff4d9367f9b72da52 differ
diff --git a/fuzz/wget_html_fuzzer.in/4286be005b7f3c34c6556e967411c37bd4cf7c61 b/fuzz/wget_html_fuzzer.in/4286be005b7f3c34c6556e967411c37bd4cf7c61
new file mode 100644
index 00000000..dee9dd91
Binary files /dev/null and b/fuzz/wget_html_fuzzer.in/4286be005b7f3c34c6556e967411c37bd4cf7c61 differ
diff --git a/fuzz/wget_html_fuzzer.in/42afd277d8b495b6438a220c6df4cc6887805f5e b/fuzz/wget_html_fuzzer.in/42afd277d8b495b6438a220c6df4cc6887805f5e
new file mode 100644
index 00000000..e3bce97f
Binary files /dev/null and b/fuzz/wget_html_fuzzer.in/42afd277d8b495b6438a220c6df4cc6887805f5e differ
diff --git a/fuzz/wget_html_fuzzer.in/42b0c2096595bbb4943501223ad491df5b675acc b/fuzz/wget_html_fuzzer.in/42b0c2096595bbb4943501223ad491df5b675acc
new file mode 100644
index 00000000..8556d1e1
--- /dev/null
+++ b/fuzz/wget_html_fuzzer.in/42b0c2096595bbb4943501223ad491df5b675acc
@@ -0,0 +1 @@
+*e
\ No newline at end of file
diff --git a/fuzz/wget_html_fuzzer.in/4ca126418c60455258e6bd0b96ab2201be7a7e57 b/fuzz/wget_html_fuzzer.in/4ca126418c60455258e6bd0b96ab2201be7a7e57
new file mode 100644
index 00000000..d0a792e4
Binary files /dev/null and b/fuzz/wget_html_fuzzer.in/4ca126418c60455258e6bd0b96ab2201be7a7e57 differ
diff --git a/fuzz/wget_html_fuzzer.in/4ca86ea722340d1fc46dfea030ba6868442ba936 b/fuzz/wget_html_fuzzer.in/4ca86ea722340d1fc46dfea030ba6868442ba936
new file mode 100644
index 00000000..b182a698
Binary files /dev/null and b/fuzz/wget_html_fuzzer.in/4ca86ea722340d1fc46dfea030ba6868442ba936 differ
diff --git a/fuzz/wget_html_fuzzer.in/4cac56b9841064fedf36669674bd69345b902f6a b/fuzz/wget_html_fuzzer.in/4cac56b9841064fedf36669674bd69345b902f6a
new file mode 100644
index 00000000..7d771575
Binary files /dev/null and b/fuzz/wget_html_fuzzer.in/4cac56b9841064fedf36669674bd69345b902f6a differ
diff --git a/fuzz/wget_html_fuzzer.in/4caf3df5796852127fbbbf718212c1129f6d986d b/fuzz/wget_html_fuzzer.in/4caf3df5796852127fbbbf718212c1129f6d986d
new file mode 100644
index 00000000..92299316
Binary files /dev/null and b/fuzz/wget_html_fuzzer.in/4caf3df5796852127fbbbf718212c1129f6d986d differ
diff --git a/fuzz/wget_html_fuzzer.in/4ce16755345a471a86da4e6511679602d7297c87 b/fuzz/wget_html_fuzzer.in/4ce16755345a471a86da4e6511679602d7297c87
new file mode 100644
index 00000000..d1efd4db
Binary files /dev/null and b/fuzz/wget_html_fuzzer.in/4ce16755345a471a86da4e6511679602d7297c87 differ
diff --git a/fuzz/wget_html_fuzzer.in/4cf1887077264e498a075ab4085f0c1006571db3 b/fuzz/wget_html_fuzzer.in/4cf1887077264e498a075ab4085f0c1006571db3
new file mode 100644
index 00000000..957399ee
Binary files /dev/null and b/fuzz/wget_html_fuzzer.in/4cf1887077264e498a075ab4085f0c1006571db3 differ
diff --git a/fuzz/wget_html_fuzzer.in/4d14e0fb34fb917f9e2c81baa97e8fb7f8499b59 b/fuzz/wget_html_fuzzer.in/4d14e0fb34fb917f9e2c81baa97e8fb7f8499b59
new file mode 100644
index 00000000..5bb1aae0
Binary files /dev/null and b/fuzz/wget_html_fuzzer.in/4d14e0fb34fb917f9e2c81baa97e8fb7f8499b59 differ
diff --git a/fuzz/wget_html_fuzzer.in/4d29dfc08e3cf97610361d83ee11d5c9cb75440d b/fuzz/wget_html_fuzzer.in/4d29dfc08e3cf97610361d83ee11d5c9cb75440d
new file mode 100644
index 00000000..6719cd62
Binary files /dev/null and b/fuzz/wget_html_fuzzer.in/4d29dfc08e3cf97610361d83ee11d5c9cb75440d differ
diff --git a/fuzz/wget_html_fuzzer.in/4d2aa51310050e5b112d2c53ee5563dbc3d1857b b/fuzz/wget_html_fuzzer.in/4d2aa51310050e5b112d2c53ee5563dbc3d1857b
new file mode 100644
index 00000000..8381c07b
--- /dev/null
+++ b/fuzz/wget_html_fuzzer.in/4d2aa51310050e5b112d2c53ee5563dbc3d1857b
@@ -0,0 +1 @@
+*txl
\ No newline at end of file
diff --git a/fuzz/wget_html_fuzzer.in/64f8796f676be31b38f5a249bb14860fb8b5deaf b/fuzz/wget_html_fuzzer.in/64f8796f676be31b38f5a249bb14860fb8b5deaf
new file mode 100644
index 00000000..07840b7a
Binary files /dev/null and b/fuzz/wget_html_fuzzer.in/64f8796f676be31b38f5a249bb14860fb8b5deaf differ
diff --git a/fuzz/wget_html_fuzzer.in/65192e6b0777627209ce8c565049d0bb6d770062 b/fuzz/wget_html_fuzzer.in/65192e6b0777627209ce8c565049d0bb6d770062
new file mode 100644
index 00000000..44594baf
Binary files /dev/null and b/fuzz/wget_html_fuzzer.in/65192e6b0777627209ce8c565049d0bb6d770062 differ
diff --git a/fuzz/wget_html_fuzzer.in/6551cbfed56a22f3be3ecd22bf95352f4d44cf17 b/fuzz/wget_html_fuzzer.in/6551cbfed56a22f3be3ecd22bf95352f4d44cf17
new file mode 100644
index 00000000..5a116d23
Binary files /dev/null and b/fuzz/wget_html_fuzzer.in/6551cbfed56a22f3be3ecd22bf95352f4d44cf17 differ
diff --git a/fuzz/wget_html_fuzzer.in/656432092815a9f3ab8a7474d13bfd9e16b2b201 b/fuzz/wget_html_fuzzer.in/656432092815a9f3ab8a7474d13bfd9e16b2b201
new file mode 100644
index 00000000..6488dd44
Binary files /dev/null and b/fuzz/wget_html_fuzzer.in/656432092815a9f3ab8a7474d13bfd9e16b2b201 differ
diff --git a/fuzz/wget_html_fuzzer.in/65689e041bf9e4005240a91c488132f84aedc124 b/fuzz/wget_html_fuzzer.in/65689e041bf9e4005240a91c488132f84aedc124
new file mode 100644
index 00000000..23016bca
Binary files /dev/null and b/fuzz/wget_html_fuzzer.in/65689e041bf9e4005240a91c488132f84aedc124 differ
diff --git a/fuzz/wget_html_fuzzer.in/656fb7e31d8b19cd9c41de3b00fec459aee7fd79 b/fuzz/wget_html_fuzzer.in/656fb7e31d8b19cd9c41de3b00fec459aee7fd79
new file mode 100644
index 00000000..0e7dbce8
Binary files /dev/null and b/fuzz/wget_html_fuzzer.in/656fb7e31d8b19cd9c41de3b00fec459aee7fd79 differ
diff --git a/fuzz/wget_html_fuzzer.in/658656d29bdfe566cd2449548db0253c37d3eb50 b/fuzz/wget_html_fuzzer.in/658656d29bdfe566cd2449548db0253c37d3eb50
new file mode 100644
index 00000000..75bbce52
--- /dev/null
+++ b/fuzz/wget_html_fuzzer.in/658656d29bdfe566cd2449548db0253c37d3eb50
@@ -0,0 +1,2 @@
+e
\ No newline at end of file
diff --git a/fuzz/wget_html_fuzzer.in/83b145835dd45cfb26086c4e364bd2615eabe5ae b/fuzz/wget_html_fuzzer.in/83b145835dd45cfb26086c4e364bd2615eabe5ae
new file mode 100644
index 00000000..3d990500
Binary files /dev/null and b/fuzz/wget_html_fuzzer.in/83b145835dd45cfb26086c4e364bd2615eabe5ae differ
diff --git a/fuzz/wget_html_fuzzer.in/83c47c8498830b0e04065c1df1516af0a58dde51 b/fuzz/wget_html_fuzzer.in/83c47c8498830b0e04065c1df1516af0a58dde51
new file mode 100644
index 00000000..780ba565
--- /dev/null
+++ b/fuzz/wget_html_fuzzer.in/83c47c8498830b0e04065c1df1516af0a58dde51
@@ -0,0 +1,3 @@
+n/
\ No newline at end of file
diff --git a/fuzz/wget_html_fuzzer.in/a8667328a3efa5d7fb6946ba6d0e375dbf0595d7 b/fuzz/wget_html_fuzzer.in/a8667328a3efa5d7fb6946ba6d0e375dbf0595d7
new file mode 100644
index 00000000..6bd8d73f
Binary files /dev/null and b/fuzz/wget_html_fuzzer.in/a8667328a3efa5d7fb6946ba6d0e375dbf0595d7 differ
diff --git a/fuzz/wget_html_fuzzer.in/a892360c8c5ca4de4ff3e927a20b1a12135fe7be b/fuzz/wget_html_fuzzer.in/a892360c8c5ca4de4ff3e927a20b1a12135fe7be
new file mode 100644
index 00000000..160a892d
Binary files /dev/null and b/fuzz/wget_html_fuzzer.in/a892360c8c5ca4de4ff3e927a20b1a12135fe7be differ
diff --git a/fuzz/wget_html_fuzzer.in/a8aa054c5482db6b7a7b5c870e915deb36c46b11 b/fuzz/wget_html_fuzzer.in/a8aa054c5482db6b7a7b5c870e915deb36c46b11
new file mode 100644
index 00000000..a071e823
--- /dev/null
+++ b/fuzz/wget_html_fuzzer.in/a8aa054c5482db6b7a7b5c870e915deb36c46b11
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/fuzz/wget_html_fuzzer.in/ac332b19238e88eb80bba625d86eed23106de3cd b/fuzz/wget_html_fuzzer.in/ac332b19238e88eb80bba625d86eed23106de3cd
new file mode 100644
index 00000000..0d945596
Binary files /dev/null and b/fuzz/wget_html_fuzzer.in/ac332b19238e88eb80bba625d86eed23106de3cd differ
diff --git a/fuzz/wget_html_fuzzer.in/ac4b14b0a38bb6541922f797960064c8668503d5 b/fuzz/wget_html_fuzzer.in/ac4b14b0a38bb6541922f797960064c8668503d5
new file mode 100644
index 00000000..3da2002a
--- /dev/null
+++ b/fuzz/wget_html_fuzzer.in/ac4b14b0a38bb6541922f797960064c8668503d5
@@ -0,0 +1 @@
+*at ƒ ù
\ No newline at end of file
diff --git a/fuzz/wget_html_fuzzer.in/c707d11337d1929d08161757ce11fd62febbbf46 b/fuzz/wget_html_fuzzer.in/c707d11337d1929d08161757ce11fd62febbbf46
new file mode 100644
index 00000000..f8f95c28
Binary files /dev/null and b/fuzz/wget_html_fuzzer.in/c707d11337d1929d08161757ce11fd62febbbf46 differ
diff --git a/fuzz/wget_html_fuzzer.in/c71370c4bf9cdb806d0e63fcb808a75b9ec892a9 b/fuzz/wget_html_fuzzer.in/c71370c4bf9cdb806d0e63fcb808a75b9ec892a9
new file mode 100644
index 00000000..e72ccf51
Binary files /dev/null and b/fuzz/wget_html_fuzzer.in/c71370c4bf9cdb806d0e63fcb808a75b9ec892a9 differ
diff --git a/fuzz/wget_html_fuzzer.in/c748531cf5de5cde6b0a5662e0a1aa43e4f412ec b/fuzz/wget_html_fuzzer.in/c748531cf5de5cde6b0a5662e0a1aa43e4f412ec
new file mode 100644
index 00000000..45ec32f9
Binary files /dev/null and b/fuzz/wget_html_fuzzer.in/c748531cf5de5cde6b0a5662e0a1aa43e4f412ec differ
diff --git a/fuzz/wget_html_fuzzer.in/c74c813413a914dc5f7911e37e8156cb157344ba b/fuzz/wget_html_fuzzer.in/c74c813413a914dc5f7911e37e8156cb157344ba
new file mode 100644
index 00000000..78e2df3f
Binary files /dev/null and b/fuzz/wget_html_fuzzer.in/c74c813413a914dc5f7911e37e8156cb157344ba differ
diff --git a/fuzz/wget_html_fuzzer.in/c75cd638b8a078f5f6ab111e2d64fbf85ddd3b90 b/fuzz/wget_html_fuzzer.in/c75cd638b8a078f5f6ab111e2d64fbf85ddd3b90
new file mode 100644
index 00000000..7d12efaf
Binary files /dev/null and b/fuzz/wget_html_fuzzer.in/c75cd638b8a078f5f6ab111e2d64fbf85ddd3b90 differ
diff --git a/fuzz/wget_html_fuzzer.in/c76a2f1db741e566ab1a7afb6e32a89b155d691b b/fuzz/wget_html_fuzzer.in/c76a2f1db741e566ab1a7afb6e32a89b155d691b
new file mode 100644
index 00000000..0c331503
Binary files /dev/null and b/fuzz/wget_html_fuzzer.in/c76a2f1db741e566ab1a7afb6e32a89b155d691b differ
diff --git a/fuzz/wget_html_fuzzer.in/c7bc5cd1240985d4c3b9ec250f7e99758523edf0 b/fuzz/wget_html_fuzzer.in/c7bc5cd1240985d4c3b9ec250f7e99758523edf0
new file mode 100644
index 00000000..11434cf6
Binary files /dev/null and b/fuzz/wget_html_fuzzer.in/c7bc5cd1240985d4c3b9ec250f7e99758523edf0 differ
diff --git a/fuzz/wget_html_fuzzer.in/c7d56fd506f9c8ceaad3f13322f96a32e3349187 b/fuzz/wget_html_fuzzer.in/c7d56fd506f9c8ceaad3f13322f96a32e3349187
new file mode 100644
index 00000000..75113982
Binary files /dev/null and b/fuzz/wget_html_fuzzer.in/c7d56fd506f9c8ceaad3f13322f96a32e3349187 differ
diff --git a/fuzz/wget_html_fuzzer.in/c7d877e13f7e2ca5dc339754eb05455e3cca6f25 b/fuzz/wget_html_fuzzer.in/c7d877e13f7e2ca5dc339754eb05455e3cca6f25
new file mode 100644
index 00000000..87da8916
Binary files /dev/null and b/fuzz/wget_html_fuzzer.in/c7d877e13f7e2ca5dc339754eb05455e3cca6f25 differ
diff --git a/fuzz/wget_html_fuzzer.in/c80c36f6fc6056ff681b52271bb960274de3152e b/fuzz/wget_html_fuzzer.in/c80c36f6fc6056ff681b52271bb960274de3152e
new file mode 100644
index 00000000..e4e9800f
Binary files /dev/null and b/fuzz/wget_html_fuzzer.in/c80c36f6fc6056ff681b52271bb960274de3152e differ
diff --git a/fuzz/wget_html_fuzzer.in/c826f4ae97bd9b5669d060e8f36cc21e3c5a2a0f b/fuzz/wget_html_fuzzer.in/c826f4ae97bd9b5669d060e8f36cc21e3c5a2a0f
new file mode 100644
index 00000000..b73b8322
Binary files /dev/null and b/fuzz/wget_html_fuzzer.in/c826f4ae97bd9b5669d060e8f36cc21e3c5a2a0f differ
diff --git a/fuzz/wget_html_fuzzer.in/c829f76900aa26fb6b578adb7f35fe8246a8d5c7 b/fuzz/wget_html_fuzzer.in/c829f76900aa26fb6b578adb7f35fe8246a8d5c7
new file mode 100644
index 00000000..7ef0e4dc
Binary files /dev/null and b/fuzz/wget_html_fuzzer.in/c829f76900aa26fb6b578adb7f35fe8246a8d5c7 differ
diff --git a/fuzz/wget_html_fuzzer.in/c836ed232ff94e780695d63818748c3858121c16 b/fuzz/wget_html_fuzzer.in/c836ed232ff94e780695d63818748c3858121c16
new file mode 100644
index 00000000..5061a2bd
Binary files /dev/null and b/fuzz/wget_html_fuzzer.in/c836ed232ff94e780695d63818748c3858121c16 differ
diff --git a/fuzz/wget_html_fuzzer.in/c842b67f7e5ed9f6efc80fe6939296c96a2b2a85 b/fuzz/wget_html_fuzzer.in/c842b67f7e5ed9f6efc80fe6939296c96a2b2a85
new file mode 100644
index 00000000..1c3a8b16
Binary files /dev/null and b/fuzz/wget_html_fuzzer.in/c842b67f7e5ed9f6efc80fe6939296c96a2b2a85 differ
diff --git a/fuzz/wget_html_fuzzer.in/c8450a4c12e514750b186f23c0235e1494ed808d b/fuzz/wget_html_fuzzer.in/c8450a4c12e514750b186f23c0235e1494ed808d
new file mode 100644
index 00000000..72a18a59
Binary files /dev/null and b/fuzz/wget_html_fuzzer.in/c8450a4c12e514750b186f23c0235e1494ed808d differ
diff --git a/fuzz/wget_html_fuzzer.in/c8769c459701f257de12cd7a06e07887229aa8f2 b/fuzz/wget_html_fuzzer.in/c8769c459701f257de12cd7a06e07887229aa8f2
new file mode 100644
index 00000000..58113a58
Binary files /dev/null and b/fuzz/wget_html_fuzzer.in/c8769c459701f257de12cd7a06e07887229aa8f2 differ
diff --git a/fuzz/wget_html_fuzzer.in/c883956fb361041d080be40b84f1a0dc74341775 b/fuzz/wget_html_fuzzer.in/c883956fb361041d080be40b84f1a0dc74341775
new file mode 100644
index 00000000..fc16aeef
Binary files /dev/null and b/fuzz/wget_html_fuzzer.in/c883956fb361041d080be40b84f1a0dc74341775 differ
diff --git a/fuzz/wget_html_fuzzer.in/c8854119befa342007efda4652f6dee5f1679561 b/fuzz/wget_html_fuzzer.in/c8854119befa342007efda4652f6dee5f1679561
new file mode 100644
index 00000000..6e32e54e
--- /dev/null
+++ b/fuzz/wget_html_fuzzer.in/c8854119befa342007efda4652f6dee5f1679561
@@ -0,0 +1,2 @@
+atee//"
\ No newline at end of file
diff --git a/fuzz/wget_html_fuzzer.in/d751b2171ce7bdad835028eb7f77b9e05bd10686 b/fuzz/wget_html_fuzzer.in/d751b2171ce7bdad835028eb7f77b9e05bd10686
new file mode 100644
index 00000000..6ad9d9f8
--- /dev/null
+++ b/fuzz/wget_html_fuzzer.in/d751b2171ce7bdad835028eb7f77b9e05bd10686
@@ -0,0 +1 @@
+ÿallsra name="robots" href $ h style= ]]]]]]S]]]]]]]]W]]]1]]]]]]]]]]]]]]]]]]ª’„„„„„„„„„„„]]]]]]cset]charset=] n/
\ No newline at end of file
diff --git a/fuzz/wget_html_fuzzer.in/f626b3db041ba6bc1f58f9baa78f151cfa265724 b/fuzz/wget_html_fuzzer.in/f626b3db041ba6bc1f58f9baa78f151cfa265724
new file mode 100644
index 00000000..25855a9f
Binary files /dev/null and b/fuzz/wget_html_fuzzer.in/f626b3db041ba6bc1f58f9baa78f151cfa265724 differ
diff --git a/fuzz/wget_html_fuzzer.in/f62a54cdefe16e6905894de95f347df577d9c1c2 b/fuzz/wget_html_fuzzer.in/f62a54cdefe16e6905894de95f347df577d9c1c2
new file mode 100644
index 00000000..720cebad
--- /dev/null
+++ b/fuzz/wget_html_fuzzer.in/f62a54cdefe16e6905894de95f347df577d9c1c2
@@ -0,0 +1 @@
+ ]]]background]]W]]]3]]]]]]]]]]]]]]]]]]]m<]]srcset]]]]]]]]]] h * and does the right thing. */
struct urlpos *
-get_urls_html (const char *file, const char *url, bool *meta_disallow_follow,
- struct iri *iri)
+get_urls_html_fm (const char *file, const struct file_memory *fm,
+ const char *url, bool *meta_disallow_follow,
+ struct iri *iri)
{
- struct file_memory *fm;
struct map_context ctx;
int flags;
- /* Load the file. */
- fm = wget_read_file (file);
- if (!fm)
- {
- logprintf (LOG_NOTQUIET, "%s: %s\n", file, strerror (errno));
- return NULL;
- }
- DEBUGP (("Loaded %s (size %s).\n", file, number_to_static_string (fm->length)));
-
ctx.text = fm->content;
ctx.head = NULL;
ctx.base = NULL;
@@ -850,10 +841,29 @@ get_urls_html (const char *file, const char *url, bool *meta_disallow_follow,
*meta_disallow_follow = ctx.nofollow;
xfree (ctx.base);
- wget_read_file_free (fm);
return ctx.head;
}
+struct urlpos *
+get_urls_html (const char *file, const char *url, bool *meta_disallow_follow,
+ struct iri *iri)
+{
+ struct urlpos *urls;
+ struct file_memory *fm;
+
+ fm = wget_read_file (file);
+ if (!fm)
+ {
+ logprintf (LOG_NOTQUIET, "%s: %s\n", file, strerror (errno));
+ return NULL;
+ }
+ DEBUGP (("Loaded %s (size %s).\n", file, number_to_static_string (fm->length)));
+
+ urls = get_urls_html_fm (file, fm, url, meta_disallow_follow, iri);
+ wget_read_file_free (fm);
+ return urls;
+}
+
/* This doesn't really have anything to do with HTML, but it's similar
to get_urls_html, so we put it here. */
diff --git a/src/html-url.h b/src/html-url.h
index 76175664..6eaf360a 100644
--- a/src/html-url.h
+++ b/src/html-url.h
@@ -32,6 +32,7 @@ as that of the covered work. */
#define HTML_URL_H
#include
+#include "utils.h"
#include "convert.h"
#include "iri.h"
@@ -49,6 +50,7 @@ struct map_context {
struct urlpos *get_urls_file (const char *);
struct urlpos *get_urls_html (const char *, const char *, bool *, struct iri *);
+struct urlpos *get_urls_html_fm (const char *, const struct file_memory *, const char *, bool *, struct iri *);
struct urlpos *append_url (const char *, int, int, struct map_context *);
void free_urlpos (struct urlpos *);
void cleanup_html_url (void);
diff --git a/src/wget.h b/src/wget.h
index be241d9f..0210659d 100644
--- a/src/wget.h
+++ b/src/wget.h
@@ -406,7 +406,7 @@ FILE *fopen_wgetrc(const char *pathname, const char *mode);
void exit_wget(int status);
#else
/* When not fuzzing, we want to call fopen() instead of fopen_wgetrc() */
-# define fopen_wgetrc(fp) fopen(fp)
+# define fopen_wgetrc(fp, mode) fopen(fp, mode)
#endif /* FUZZING && TESTING */
#endif /* WGET_H */