Skip to content

Commit

Permalink
Fix code analysis warning
Browse files Browse the repository at this point in the history
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
  • Loading branch information
dthaler committed May 27, 2022
1 parent c231e23 commit 0d87f47
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tests/libfuzzer/core_helper_fuzzer/libfuzz_harness.cpp
Expand Up @@ -335,8 +335,10 @@ fuzz_program(
break;
}
case EBPF_ARGUMENT_TYPE_CONST_SIZE: {
// Put the supplied size into the argument.
assert(arg_count > 0);
assert(argument[arg_count - 1] != 0);

// Put the supplied size into the argument.
uint8_t arg_size;
if (!consume_data(&data_left, &data_left_size, (uint8_t*)&arg_size, sizeof(arg_size)) || (arg_size == 0) ||
(arg_size > MAX_BUFFER_SIZE)) {
Expand All @@ -351,8 +353,10 @@ fuzz_program(
break;
}
case EBPF_ARGUMENT_TYPE_CONST_SIZE_OR_ZERO: {
// Put the supplied size into the argument.
assert(arg_count > 0);
assert(argument[arg_count - 1] != 0);

// Put the supplied size into the argument.
uint8_t arg_size;
if (!consume_data(&data_left, &data_left_size, (uint8_t*)&arg_size, sizeof(arg_size)) ||
(arg_size > MAX_BUFFER_SIZE)) {
Expand Down

0 comments on commit 0d87f47

Please sign in to comment.