Skip to content

Commit

Permalink
update fuzzer to use size_t
Browse files Browse the repository at this point in the history
  • Loading branch information
pabuhler committed Jan 5, 2024
1 parent a4f2a7e commit af2e047
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 29 deletions.
30 changes: 15 additions & 15 deletions fuzzer/fuzzer.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ void fuzz_free(void *ptr)

static srtp_err_status_t fuzz_srtp_protect(srtp_t srtp_sender,
void *hdr,
int *len,
size_t *len,
uint8_t use_mki,
unsigned int mki)
{
Expand All @@ -193,7 +193,7 @@ static srtp_err_status_t fuzz_srtp_protect(srtp_t srtp_sender,

static srtp_err_status_t fuzz_srtp_unprotect(srtp_t srtp_sender,
void *hdr,
int *len,
size_t *len,
uint8_t use_mki,
unsigned int mki)
{
Expand All @@ -202,7 +202,7 @@ static srtp_err_status_t fuzz_srtp_unprotect(srtp_t srtp_sender,

static srtp_err_status_t fuzz_srtp_protect_rtcp(srtp_t srtp_sender,
void *hdr,
int *len,
size_t *len,
uint8_t use_mki,
unsigned int mki)
{
Expand All @@ -211,7 +211,7 @@ static srtp_err_status_t fuzz_srtp_protect_rtcp(srtp_t srtp_sender,

static srtp_err_status_t fuzz_srtp_unprotect_rtcp(srtp_t srtp_sender,
void *hdr,
int *len,
size_t *len,
uint8_t use_mki,
unsigned int mki)
{
Expand All @@ -220,7 +220,7 @@ static srtp_err_status_t fuzz_srtp_unprotect_rtcp(srtp_t srtp_sender,

static srtp_err_status_t fuzz_srtp_protect_mki(srtp_t srtp_sender,
void *hdr,
int *len,
size_t *len,
uint8_t use_mki,
unsigned int mki)
{
Expand All @@ -229,7 +229,7 @@ static srtp_err_status_t fuzz_srtp_protect_mki(srtp_t srtp_sender,

static srtp_err_status_t fuzz_srtp_protect_rtcp_mki(srtp_t srtp_sender,
void *hdr,
int *len,
size_t *len,
uint8_t use_mki,
unsigned int mki)
{
Expand All @@ -238,7 +238,7 @@ static srtp_err_status_t fuzz_srtp_protect_rtcp_mki(srtp_t srtp_sender,

static srtp_err_status_t fuzz_srtp_unprotect_mki(srtp_t srtp_sender,
void *hdr,
int *len,
size_t *len,
uint8_t use_mki,
unsigned int mki)
{
Expand All @@ -247,7 +247,7 @@ static srtp_err_status_t fuzz_srtp_unprotect_mki(srtp_t srtp_sender,

static srtp_err_status_t fuzz_srtp_unprotect_rtcp_mki(srtp_t srtp_sender,
void *hdr,
int *len,
size_t *len,
uint8_t use_mki,
unsigned int mki)
{
Expand All @@ -259,7 +259,7 @@ static srtp_err_status_t fuzz_srtp_unprotect_rtcp_mki(srtp_t srtp_sender,
static srtp_err_status_t fuzz_srtp_get_protect_length(const srtp_t srtp_ctx,
uint8_t use_mki,
unsigned int mki,
uint32_t *length)
size_t *length)
{
return srtp_get_protect_trailer_length(srtp_ctx, 0, 0, length);
}
Expand All @@ -268,15 +268,15 @@ static srtp_err_status_t fuzz_srtp_get_protect_rtcp_length(
const srtp_t srtp_ctx,
uint8_t use_mki,
unsigned int mki,
uint32_t *length)
size_t *length)
{
return srtp_get_protect_rtcp_trailer_length(srtp_ctx, 0, 0, length);
}

static srtp_err_status_t fuzz_srtp_get_protect_mki_length(const srtp_t srtp_ctx,
uint8_t use_mki,
unsigned int mki,
uint32_t *length)
size_t *length)
{
return srtp_get_protect_trailer_length(srtp_ctx, use_mki, mki, length);
}
Expand All @@ -285,7 +285,7 @@ static srtp_err_status_t fuzz_srtp_get_protect_rtcp_mki_length(
const srtp_t srtp_ctx,
uint8_t use_mki,
unsigned int mki,
uint32_t *length)
size_t *length)
{
return srtp_get_protect_rtcp_trailer_length(srtp_ctx, use_mki, mki, length);
}
Expand Down Expand Up @@ -621,7 +621,7 @@ static uint8_t *run_srtp_func(const srtp_t srtp_ctx,
uint8_t use_mki;
uint32_t mki;
} params_2;
int ret_size;
size_t ret_size;

EXTRACT_IF(&params_1, *data, *size, sizeof(params_1));
params_1.srtp_func %= sizeof(srtp_funcs) / sizeof(srtp_funcs[0]);
Expand All @@ -644,7 +644,7 @@ static uint8_t *run_srtp_func(const srtp_t srtp_ctx,
if (srtp_funcs[params_1.srtp_func].protect == true) {
/* Intentionally not initialized to trigger MemorySanitizer, if
* applicable */
uint32_t alloc_size;
size_t alloc_size;

if (srtp_funcs[params_1.srtp_func].get_length(
srtp_ctx, params_1.use_mki, params_1.mki, &alloc_size) !=
Expand Down Expand Up @@ -682,7 +682,7 @@ static uint8_t *run_srtp_func(const srtp_t srtp_ctx,
if (srtp_funcs[params_2.srtp_func].protect == true) {
/* Intentionally not initialized to trigger MemorySanitizer, if
* applicable */
uint32_t alloc_size;
size_t alloc_size;

if (srtp_funcs[params_2.srtp_func].get_length(
srtp_ctx, params_2.use_mki, params_2.mki, &alloc_size) !=
Expand Down
28 changes: 14 additions & 14 deletions fuzzer/fuzzer.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
#endif

typedef srtp_err_status_t (
*fuzz_srtp_func)(srtp_t, void *, int *, uint8_t, unsigned int);
*fuzz_srtp_func)(srtp_t, void *, size_t *, uint8_t, unsigned int);
typedef void (*fuzz_srtp_crypto_policy_func)(srtp_crypto_policy_t *);
typedef srtp_err_status_t (*fuzz_srtp_get_length_func)(const srtp_t,
uint8_t,
unsigned int,
uint32_t *);
size_t *);

struct fuzz_srtp_params {
uint8_t srtp_func;
Expand All @@ -44,63 +44,63 @@ struct fuzz_srtp_params {

static srtp_err_status_t fuzz_srtp_protect(srtp_t srtp_sender,
void *hdr,
int *len,
size_t *len,
uint8_t use_mki,
unsigned int mki);
static srtp_err_status_t fuzz_srtp_unprotect(srtp_t srtp_sender,
void *hdr,
int *len,
size_t *len,
uint8_t use_mki,
unsigned int mki);
static srtp_err_status_t fuzz_srtp_protect_rtcp(srtp_t srtp_sender,
void *hdr,
int *len,
size_t *len,
uint8_t use_mki,
unsigned int mki);
static srtp_err_status_t fuzz_srtp_unprotect_rtcp(srtp_t srtp_sender,
void *hdr,
int *len,
size_t *len,
uint8_t use_mki,
unsigned int mki);
static srtp_err_status_t fuzz_srtp_protect_mki(srtp_t srtp_sender,
void *hdr,
int *len,
size_t *len,
uint8_t use_mki,
unsigned int mki);
static srtp_err_status_t fuzz_srtp_protect_rtcp_mki(srtp_t srtp_sender,
void *hdr,
int *len,
size_t *len,
uint8_t use_mki,
unsigned int mki);
static srtp_err_status_t fuzz_srtp_unprotect_mki(srtp_t srtp_sender,
void *hdr,
int *len,
size_t *len,
uint8_t use_mki,
unsigned int mki);
static srtp_err_status_t fuzz_srtp_unprotect_rtcp_mki(srtp_t srtp_sender,
void *hdr,
int *len,
size_t *len,
uint8_t use_mki,
unsigned int mki);

static srtp_err_status_t fuzz_srtp_get_protect_length(const srtp_t srtp_ctx,
uint8_t use_mki,
unsigned int mki,
uint32_t *length);
size_t *length);
static srtp_err_status_t fuzz_srtp_get_protect_mki_length(const srtp_t srtp_ctx,
uint8_t use_mki,
unsigned int mki,
uint32_t *length);
size_t *length);
static srtp_err_status_t fuzz_srtp_get_protect_rtcp_length(
const srtp_t srtp_ctx,
uint8_t use_mki,
unsigned int mki,
uint32_t *length);
size_t *length);
static srtp_err_status_t fuzz_srtp_get_protect_rtcp_mki_length(
const srtp_t srtp_ctx,
uint8_t use_mki,
unsigned int mki,
uint32_t *length);
size_t *length);

struct fuzz_srtp_func_ext {
fuzz_srtp_func srtp_func;
Expand Down

0 comments on commit af2e047

Please sign in to comment.