Skip to content

Commit

Permalink
Fix crash in execution context fuzzer (#4037)
Browse files Browse the repository at this point in the history
EBPF_OPERATION_PROGRAM_TEST_RUN buffer was too short.

EBPF_OPERATION_GET_OBJECT_INFO handled the equivalent
already so applied the same fix to TEST_RUN.

Signed-off-by: Dave Thaler <[email protected]>
  • Loading branch information
dthaler authored Nov 23, 2024
1 parent 98f00df commit 06f9b48
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Binary file not shown.
6 changes: 4 additions & 2 deletions tests/libfuzzer/execution_context/libfuzz_harness.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -517,8 +517,10 @@ fuzz_ioctl(std::vector<uint8_t>& random_buffer)
if (operation_id == EBPF_OPERATION_PROGRAM_TEST_RUN) {
ebpf_operation_program_test_run_request_t* test_request =
reinterpret_cast<ebpf_operation_program_test_run_request_t*>(random_buffer.data());
if (test_request->repeat_count > 1024) {
test_request->repeat_count = 1024;
if (header->length >= EBPF_OFFSET_OF(ebpf_operation_program_test_run_request_t, data)) {
if (test_request->repeat_count > 1024) {
test_request->repeat_count = 1024;
}
}
}

Expand Down

0 comments on commit 06f9b48

Please sign in to comment.