return 0 for TestOneInput

libFuzzer discards inputs when returning non-zero, and so gets stuck for
some targets
This commit is contained in:
phi-go 2025-01-23 10:01:42 +01:00
parent 7f95a2632e
commit e1d7d71e0b

View File

@ -497,21 +497,26 @@ LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{
#if defined(TEST_FUZZ1)
/* fuzz target 1: different URI for HTTP/1 server */
return LLVMFuzzerTestOneInput_URI(data, size);
LLVMFuzzerTestOneInput_URI(data, size);
return 0;
#elif defined(TEST_FUZZ2)
/* fuzz target 2: different requests for HTTP/1 server */
return LLVMFuzzerTestOneInput_REQUEST(data, size);
LLVMFuzzerTestOneInput_REQUEST(data, size);
return 0;
#elif defined(TEST_FUZZ3)
/* fuzz target 3: different responses for HTTP/1 client */
return LLVMFuzzerTestOneInput_RESPONSE(data, size);
LLVMFuzzerTestOneInput_RESPONSE(data, size);
return 0;
#elif defined(TEST_FUZZ4)
#error "Only useful in HTTP/2 feature branch"
/* fuzz target 4: different requests for HTTP/2 server */
return LLVMFuzzerTestOneInput_REQUEST_HTTP2(data, size);
LLVMFuzzerTestOneInput_REQUEST_HTTP2(data, size);
return 0;
#elif defined(TEST_FUZZ5)
/* fuzz target 5: calling an internal server test function,
* bypassing network sockets */
return LLVMFuzzerTestOneInput_process_new_connection(data, size);
LLVMFuzzerTestOneInput_process_new_connection(data, size);
return 0;
#else
/* planned targets */
#error "Unknown fuzz target"