Fix entity decoding in attribute; create fuzzer project; simplify code

This commit is contained in:
Wilson Lin 2019-12-28 23:06:04 +11:00
commit 95be64d868
10 changed files with 143 additions and 76 deletions

3
fuzz/.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
/out
/target
/Cargo.lock

9
fuzz/Cargo.toml Normal file
View file

@ -0,0 +1,9 @@
[package]
name = "hyperbuild-fuzz-target"
version = "0.0.1"
authors = ["Wilson Lin <code@wilsonl.in>"]
edition = "2018"
[dependencies]
afl = "0.5.2"
hyperbuild = { path = ".." }

28
fuzz/in/complex.html Normal file
View file

@ -0,0 +1,28 @@
Hello &#x9;
there
<!DOCTYPE html>
<html>
<head>
</head>
<body class="&#9;
b " data="a" class=" &#9;
">
a
<div data-a='{""asin"":""B07GY8C9JV""} '>&AElig;&#65;</div>
<p> Hello </p>
<script type="text/html"><!--
<h1>In</h1>
<script>
<script>
alert();
</script>
<script>
alert();
</script>
</script>
<h1>Test</h1>
</body>
</html>

12
fuzz/in/hello-world.html Normal file
View file

@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Hello world!</title>
</head>
<body>
Hello world!
</body>
</html>

9
fuzz/in/script.html Normal file
View file

@ -0,0 +1,9 @@
<!-- HTML4 -->
<script type="text/javascript">
alert("Hello World!");
</script>
<!-- HTML5 -->
<script>
alert("Hello World!");
</script>

9
fuzz/src/main.rs Normal file
View file

@ -0,0 +1,9 @@
use afl::fuzz;
use hyperbuild::hyperbuild;
fn main() {
fuzz!(|data: &[u8]| {
let mut mut_data: Vec<u8> = data.iter().map(|x| *x).collect();
hyperbuild(&mut mut_data);
});
}