go-libwebp

Experimental translation from libwebp to Go source.
Log | Files | Refs | README | LICENSE

commit 41dac6f1dc7e1dd9044068167f7f0bedb9dc5d5a
parent 98a093fa7067145893f248ab2e4c8f083659c566
Author: Jack Mordaunt <jackmordaunt.dev@gmail.com>
Date:   Tue,  2 Jan 2024 08:41:33 +0800

webp: [fuzz] ensure output is decodable

This provides a sanity check on the encoded image.

Signed-off-by: Jack Mordaunt <jackmordaunt.dev@gmail.com>

Diffstat:
Mwebp/webp_test.go | 5++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/webp/webp_test.go b/webp/webp_test.go @@ -80,7 +80,10 @@ func FuzzEncode(f *testing.F) { } buf := bytes.NewBuffer(nil) if err := Encode(buf, m, Quality(quality)); err != nil { - t.Errorf("error: %v (x0: %d, y0: %d, x1: %d, y1: %d)", err, x0, y0, x1, y1) + t.Errorf("encode error: %v (x0: %d, y0: %d, x1: %d, y1: %d)", err, x0, y0, x1, y1) + } + if _, err := Decode(buf); err != nil { + t.Errorf("decode error: %v (x0: %d, y0: %d, x1: %d, y1: %d)", err, x0, y0, x1, y1) } }) }