Add a WEBP_NODISCARD

Change-Id: Ice66f2aa6358474d728fb19c571edc86ed139a49
This commit is contained in:
Vincent Rabaud
2023-11-10 13:57:07 +01:00
parent 24d7f9cb6e
commit 13d9c30b2b
25 changed files with 321 additions and 222 deletions

View File

@ -130,7 +130,7 @@ int LLVMFuzzerTestOneInput(const uint8_t* const data, size_t size) {
}
WebPIDelete(idec);
} else {
WebPDecode(data, size, &config);
(void)WebPDecode(data, size, &config);
}
WebPFreeDecBuffer(&config.output);

View File

@ -52,9 +52,9 @@ int LLVMFuzzerTestOneInput(const uint8_t* const data, size_t size) {
if (num_htree_groups == 0) goto Error;
// This variable is only useful when mapping is not NULL.
const int num_htree_groups_max = num_htree_groups;
ReadHuffmanCodesHelper(color_cache_bits, num_htree_groups,
num_htree_groups_max, mapping, dec, &huffman_tables,
&htree_groups);
(void)ReadHuffmanCodesHelper(color_cache_bits, num_htree_groups,
num_htree_groups_max, mapping, dec,
&huffman_tables, &htree_groups);
Error:
WebPSafeFree(mapping);

View File

@ -33,15 +33,15 @@ int LLVMFuzzerTestOneInput(const uint8_t* const data, size_t size) {
if (!mux) return 0;
WebPData chunk;
WebPMuxGetChunk(mux, "EXIF", &chunk);
WebPMuxGetChunk(mux, "ICCP", &chunk);
WebPMuxGetChunk(mux, "FUZZ", &chunk); // unknown
(void)WebPMuxGetChunk(mux, "EXIF", &chunk);
(void)WebPMuxGetChunk(mux, "ICCP", &chunk);
(void)WebPMuxGetChunk(mux, "FUZZ", &chunk); // unknown
uint32_t flags;
WebPMuxGetFeatures(mux, &flags);
(void)WebPMuxGetFeatures(mux, &flags);
WebPMuxAnimParams params;
WebPMuxGetAnimationParams(mux, &params);
(void)WebPMuxGetAnimationParams(mux, &params);
WebPMuxError status;
WebPMuxFrameInfo info;
@ -72,11 +72,11 @@ int LLVMFuzzerTestOneInput(const uint8_t* const data, size_t size) {
WebPChunkIterator chunk_iter;
if (WebPDemuxGetChunk(demux, "EXIF", 1, &chunk_iter)) {
WebPDemuxNextChunk(&chunk_iter);
(void)WebPDemuxNextChunk(&chunk_iter);
}
WebPDemuxReleaseChunkIterator(&chunk_iter);
if (WebPDemuxGetChunk(demux, "ICCP", 0, &chunk_iter)) { // 0 == last
WebPDemuxPrevChunk(&chunk_iter);
(void)WebPDemuxPrevChunk(&chunk_iter);
}
WebPDemuxReleaseChunkIterator(&chunk_iter);
// Skips FUZZ because the Demux API has no concept of (un)known chunks.

View File

@ -49,17 +49,17 @@ int LLVMFuzzerTestOneInput(const uint8_t* const data, size_t size) {
if (value % 0x10 == 0) buf_size--;
uint8_t* const ext_buf = (uint8_t*)malloc(buf_size);
if (value < 0x94) {
WebPDecodeRGBAInto(data, size, ext_buf, buf_size, stride);
(void)WebPDecodeRGBAInto(data, size, ext_buf, buf_size, stride);
#if !defined(WEBP_REDUCE_CSP)
} else if (value < 0xa9) {
WebPDecodeARGBInto(data, size, ext_buf, buf_size, stride);
(void)WebPDecodeARGBInto(data, size, ext_buf, buf_size, stride);
} else if (value < 0xbe) {
WebPDecodeBGRInto(data, size, ext_buf, buf_size, stride);
(void)WebPDecodeBGRInto(data, size, ext_buf, buf_size, stride);
} else if (value < 0xd3) {
WebPDecodeRGBInto(data, size, ext_buf, buf_size, stride);
(void)WebPDecodeRGBInto(data, size, ext_buf, buf_size, stride);
#endif // !defined(WEBP_REDUCE_CSP)
} else {
WebPDecodeBGRAInto(data, size, ext_buf, buf_size, stride);
(void)WebPDecodeBGRAInto(data, size, ext_buf, buf_size, stride);
}
free(ext_buf);
} else {
@ -75,8 +75,9 @@ int LLVMFuzzerTestOneInput(const uint8_t* const data, size_t size) {
uint8_t* const luma_buf = (uint8_t*)malloc(luma_size);
uint8_t* const u_buf = (uint8_t*)malloc(u_size);
uint8_t* const v_buf = (uint8_t*)malloc(v_size);
WebPDecodeYUVInto(data, size, luma_buf, luma_size, w /* luma_stride */,
u_buf, u_size, uv_stride, v_buf, v_size, uv_stride);
(void)WebPDecodeYUVInto(data, size, luma_buf, luma_size,
w /* luma_stride */, u_buf, u_size, uv_stride,
v_buf, v_size, uv_stride);
free(luma_buf);
free(u_buf);
free(v_buf);