oss-fuzz: Further support for running with threading support

This commit is contained in:
Jon Shallow authored and Jon Shallow committed 2026-05-30 14:15:54 +01:00
1 parent be107f0229
commit eb73b10e64
6 files changed
+14

No files matched your search

+4
View File
@@ -176,8 +176,10 @@ LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
coap_session_max_pdu_size(session));
if (pdu) {
coap_add_option(pdu, COAP_OPTION_URI_PATH, 4, (const uint8_t *)"test");
coap_lock_lock(return 0);
coap_add_data_large_request_lkd(session, pdu, data_len, test_data, NULL,
NULL);
coap_lock_unlock();
coap_delete_pdu(pdu);
}
@@ -201,7 +203,9 @@ LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
token.s = token_buf;
coap_cancel_observe(session, &token, COAP_MESSAGE_CON);
coap_lock_lock(return 0);
coap_cancel_observe_lkd(session, &token, COAP_MESSAGE_CON);
coap_lock_unlock();
coap_delete_pdu(pdu);
}
+2
View File
@@ -88,7 +88,9 @@ coap_fuzz_dispatch(coap_context_t *ctx, coap_session_t *session,
uint8_t *copy = malloc(size);
if (copy) {
memcpy(copy, data, size);
coap_lock_lock(return);
coap_handle_dgram(ctx, session, copy, size);
coap_lock_unlock();
free(copy);
}
}
+2
View File
@@ -11,7 +11,9 @@ test_dgram_dispatch(coap_context_t *ctx, coap_session_t *session,
}
session->state = COAP_SESSION_STATE_ESTABLISHED;
coap_lock_lock(return);
coap_handle_dgram(ctx, session, data, size);
coap_lock_unlock();
}
/* Test retransmission queue operations (coap_wait_ack, peek_next, pop_next) */
+2
View File
@@ -74,7 +74,9 @@ LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
}
/* Test OSCORE decryption */
coap_lock_lock(return 0);
decrypted = coap_oscore_decrypt_pdu(session, pdu);
coap_lock_unlock();
if (decrypted) {
coap_show_pdu(COAP_LOG_ERR, decrypted);
coap_delete_pdu(decrypted);
+2
View File
@@ -146,7 +146,9 @@ LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
if (data[1] & 0x01) {
/* Delete the subscription and trigger the observe deleted callback */
coap_lock_lock(return 0);
coap_delete_observer(res, sess, &pdu->actual_token);
coap_lock_unlock();
}
}
+2
View File
@@ -91,7 +91,9 @@ ws_fuzz_drive_read(coap_session_t *session, uint8_t *scratch,
if (g_cursor.pos >= g_cursor.size)
return;
size_t before = g_cursor.pos;
coap_lock_lock(return);
ssize_t r = coap_ws_read(session, scratch, scratch_len);
coap_lock_unlock();
if (r < 0)
return;
/* No forward progress and no bytes returned: avoid infinite spin. */