mirror of https://github.com/google/oss-fuzz.git
golang: modify fuzzer (#8541)
Signed-off-by: AdamKorcz <adam@adalogics.com> Signed-off-by: AdamKorcz <adam@adalogics.com>
This commit is contained in:
parent
e8ac9ba77e
commit
d5eb14f834
|
@ -34,7 +34,7 @@ COPY build.sh text_fuzzer.go \
|
|||
ecdsa_fuzzer.go \
|
||||
aes_fuzzer.go \
|
||||
h2c_fuzzer.go \
|
||||
fuzz_h2c.options \
|
||||
fuzz_x_h2c.options \
|
||||
elf_fuzzer.go \
|
||||
tiff_fuzzer.go \
|
||||
fuzz_tiff_decode.options \
|
||||
|
|
|
@ -116,7 +116,7 @@ cd $SRC/net/http2/h2c
|
|||
cd $SRC/instrumentation && go run main.go $SRC/net && cd -
|
||||
go mod tidy -e -go=1.16 && go mod tidy -e -go=1.17
|
||||
compile_go_fuzzer . FuzzH2c fuzz_x_h2c
|
||||
mv $SRC/fuzz_h2c.options $OUT/
|
||||
mv $SRC/fuzz_x_h2c.options $OUT/
|
||||
|
||||
cp $SRC/openpgp_fuzzer.go $SRC/crypto/openpgp/packet
|
||||
cd $SRC/crypto/openpgp/packet
|
||||
|
|
|
@ -18,14 +18,13 @@ package h2c
|
|||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"golang.org/x/net/http2"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/textproto"
|
||||
"net/url"
|
||||
"runtime"
|
||||
"strings"
|
||||
)
|
||||
|
@ -93,9 +92,9 @@ func FuzzH2c(data []byte) int {
|
|||
}
|
||||
h := NewHandler(handler, h2s)
|
||||
w := &FakeHttpWriter{}
|
||||
r := &http.Request{
|
||||
Body: io.NopCloser(bytes.NewReader(data)),
|
||||
URL: &url.URL{Path: "nil"},
|
||||
r, err := http.NewRequestWithContext(context.Background(), "PUT", "nil", bytes.NewReader(data))
|
||||
if err != nil {
|
||||
return -1
|
||||
}
|
||||
r.Header = headerMap
|
||||
defer catchPanics()
|
||||
|
|
Loading…
Reference in New Issue