diff options
author | Nigel Tao <nigeltao@golang.org> | 2021-03-19 14:03:05 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-18 20:03:05 -0700 |
commit | 8f4d33b6ccd438dd30cc3b235f442b5bb4424198 (patch) | |
tree | d09ec76ff505593ca9f5783ed9a5adcd6ddb7640 | |
parent | f92a6cd3f7e4be28f166bf1f6034c58fefd7f216 (diff) | |
download | oss-fuzz-8f4d33b6ccd438dd30cc3b235f442b5bb4424198.tar.gz |
[go-snappy] reject large inputs to avoid OOM (#5443)
Updates https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=32135
-rw-r--r-- | projects/go-snappy/fuzz.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/projects/go-snappy/fuzz.go b/projects/go-snappy/fuzz.go index e3c211823..6722fd02d 100644 --- a/projects/go-snappy/fuzz.go +++ b/projects/go-snappy/fuzz.go @@ -7,6 +7,9 @@ import ( ) func FuzzRoundTrip(data []byte) int { + if len(data) > 1234567 { + return 0 + } encoded := Encode(nil, data) decoded, err := Decode(nil, encoded) if err != nil { @@ -19,6 +22,9 @@ func FuzzRoundTrip(data []byte) int { } func FuzzDecode(data []byte) int { + if n, _ := DecodedLen(data); n > 1234567 { + return 0 + } _, err := Decode(nil, data) if err != nil { return 0 |