mirror of
https://github.com/webmproject/libwebp.git
synced 2024-11-20 04:18:26 +01:00
Skip big scaled advanced_api_fuzzer
To avoid timeouts. Change-Id: I8f04fd45313bef47004a616d2460be992692030d
This commit is contained in:
parent
52b6f06703
commit
1347a32d82
@ -22,7 +22,6 @@
|
|||||||
#include "src/webp/decode.h"
|
#include "src/webp/decode.h"
|
||||||
|
|
||||||
int LLVMFuzzerTestOneInput(const uint8_t* const data, size_t size) {
|
int LLVMFuzzerTestOneInput(const uint8_t* const data, size_t size) {
|
||||||
int i;
|
|
||||||
WebPDecoderConfig config;
|
WebPDecoderConfig config;
|
||||||
if (!WebPInitDecoderConfig(&config)) return 0;
|
if (!WebPInitDecoderConfig(&config)) return 0;
|
||||||
if (WebPGetFeatures(data, size, &config.input) != VP8_STATUS_OK) return 0;
|
if (WebPGetFeatures(data, size, &config.input) != VP8_STATUS_OK) return 0;
|
||||||
@ -64,7 +63,7 @@ int LLVMFuzzerTestOneInput(const uint8_t* const data, size_t size) {
|
|||||||
config.output.colorspace = (WEBP_CSP_MODE)(value % MODE_LAST);
|
config.output.colorspace = (WEBP_CSP_MODE)(value % MODE_LAST);
|
||||||
#endif // WEBP_REDUCE_CSP
|
#endif // WEBP_REDUCE_CSP
|
||||||
|
|
||||||
for (i = 0; i < 2; ++i) {
|
for (int i = 0; i < 2; ++i) {
|
||||||
if (i == 1) {
|
if (i == 1) {
|
||||||
// Use the bitstream data to generate extreme ranges for the options. An
|
// Use the bitstream data to generate extreme ranges for the options. An
|
||||||
// alternative approach would be to use a custom corpus containing webp
|
// alternative approach would be to use a custom corpus containing webp
|
||||||
@ -80,12 +79,24 @@ int LLVMFuzzerTestOneInput(const uint8_t* const data, size_t size) {
|
|||||||
int scaled_height = config.options.scaled_height;
|
int scaled_height = config.options.scaled_height;
|
||||||
if (WebPRescalerGetScaledDimensions(config.input.width,
|
if (WebPRescalerGetScaledDimensions(config.input.width,
|
||||||
config.input.height, &scaled_width,
|
config.input.height, &scaled_width,
|
||||||
&scaled_height) &&
|
&scaled_height)) {
|
||||||
(uint64_t)scaled_width * scaled_height > kFuzzPxLimit) {
|
size_t fuzz_px_limit = kFuzzPxLimit;
|
||||||
|
if (scaled_width != config.input.width ||
|
||||||
|
scaled_height != config.input.height) {
|
||||||
|
// Using the WebPRescalerImport internally can significantly slow
|
||||||
|
// down the execution. Avoid timeouts due to that.
|
||||||
|
fuzz_px_limit /= 2;
|
||||||
|
}
|
||||||
|
// A big output canvas can lead to out-of-memory and timeout issues,
|
||||||
|
// but a big internal working buffer can too.
|
||||||
|
if ((uint64_t)scaled_width * scaled_height > fuzz_px_limit ||
|
||||||
|
(uint64_t)config.input.width * config.input.height >
|
||||||
|
fuzz_px_limit) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (size % 3) {
|
if (size % 3) {
|
||||||
// Decodes incrementally in chunks of increasing size.
|
// Decodes incrementally in chunks of increasing size.
|
||||||
WebPIDecoder* idec = WebPIDecode(NULL, 0, &config);
|
WebPIDecoder* idec = WebPIDecode(NULL, 0, &config);
|
||||||
|
Loading…
Reference in New Issue
Block a user