WebP codec does not validate alpha channel
Summary
The WebP codec is capable of supporting an alpha channel. If the TIFF is marked such that TIFFTAG_EXTRASAMPLES reports EXTRASAMPLE_UNASSALPHA (and perhaps EXTRASAMPLE_ASSOCALPHA), the program invoking libtiff will then assume that a valid alpha channel will be returned. Unfortunately, it appears that the WebP codec decodes based on the WebP content, and so it may initialize only the RGB channels, even though an alpha channel was expected by the using code. This has been resulting in quite a few "Use-of-uninitialized-value" reports in GraphicsMagick oss-fuzz testing.
It would be useful if libtiff's WebP codec verifies that the WebP content is compatible with its TIFF metadata and rejects the input if the claimed alpha channel is not present. Alternatively, a zeroed alpha channel could be fabricated.
Version
Libtiff 4.5.1, Libwebp v0.6.1
Steps to reproduce
A sample file is attached.
clusterfuzz-testcase-minimized-coder_BIGTIFF_fuzzer-5842416771661824
Platform
Ubuntu 20.04 LTS, GCC 10.3.0