summaryrefslogtreecommitdiff
path: root/vendor/golang.org/x/image/tiff/fuzz.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2022-08-10 14:05:14 +0200
committerLibravatar GitHub <noreply@github.com>2022-08-10 14:05:14 +0200
commit91c8d5d20d9abee8113614ef49b1a626c76c16b4 (patch)
tree745d1b3df4b32b50bc098770d44e5f4f9f72311b /vendor/golang.org/x/image/tiff/fuzz.go
parent[bugfix] Fix placeholder typo in user panel (#745) (diff)
downloadgotosocial-91c8d5d20d9abee8113614ef49b1a626c76c16b4.tar.xz
[bugfix] Fix thumbnails not taking exif rotation into account (#746)
* use disintegration/imaging instead of nfnt/resize * update tests * use disintegration lib for thumbing (if necessary)
Diffstat (limited to 'vendor/golang.org/x/image/tiff/fuzz.go')
-rw-r--r--vendor/golang.org/x/image/tiff/fuzz.go29
1 files changed, 29 insertions, 0 deletions
diff --git a/vendor/golang.org/x/image/tiff/fuzz.go b/vendor/golang.org/x/image/tiff/fuzz.go
new file mode 100644
index 000000000..ec52c7882
--- /dev/null
+++ b/vendor/golang.org/x/image/tiff/fuzz.go
@@ -0,0 +1,29 @@
+// Copyright 2019 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build gofuzz
+
+package tiff
+
+import "bytes"
+
+func Fuzz(data []byte) int {
+ cfg, err := DecodeConfig(bytes.NewReader(data))
+ if err != nil {
+ return 0
+ }
+ if cfg.Width*cfg.Height > 1e6 {
+ return 0
+ }
+ img, err := Decode(bytes.NewReader(data))
+ if err != nil {
+ return 0
+ }
+ var w bytes.Buffer
+ err = Encode(&w, img, nil)
+ if err != nil {
+ panic(err)
+ }
+ return 1
+}