-
Notifications
You must be signed in to change notification settings - Fork 118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Try2 increase code coverage #290
base: master
Are you sure you want to change the base?
Changes from all commits
74de349
634179c
34c2e5f
926d85e
8b854d5
ea270b7
605ceed
20445ea
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#include <string.h> | ||
#include <stdio.h> | ||
#include "picotls.h" | ||
#include "picotls/openssl.h" | ||
#include "quicly.h" | ||
#include "quicly/defaults.h" | ||
#include "quicly/streambuf.h" | ||
|
||
void __sanitizer_cov_trace_pc(void) | ||
{ | ||
} | ||
|
||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) | ||
{ | ||
|
||
static const uint8_t zero_key[PTLS_MAX_SECRET_SIZE] = {0}; | ||
ptls_buffer_t buf; | ||
char b[3]; | ||
ptls_aead_context_t *enc = ptls_aead_new(&ptls_openssl_aes128gcm, &ptls_openssl_sha256, 1, zero_key, ""); | ||
ptls_buffer_init(&buf, b, 0); | ||
|
||
quicly_encrypt_address_token(ptls_openssl_random_bytes, enc, &buf, Size, (quicly_address_token_plaintext_t *)Data); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4909,7 +4909,10 @@ void quicly_amend_ptls_context(ptls_context_t *ptls) | |
int quicly_encrypt_address_token(void (*random_bytes)(void *, size_t), ptls_aead_context_t *aead, ptls_buffer_t *buf, | ||
size_t start_off, const quicly_address_token_plaintext_t *plaintext) | ||
{ | ||
int ret; | ||
int ret = 0; | ||
|
||
if (start_off < sizeof(quicly_address_token_plaintext_t)) | ||
goto Exit; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure if this change is necessary. As stated in the doc-comment of the doc-comment of the function declaration, the role of the function is to append token to the buffer being provided, considering bytes between start_off and Also, the function is expected to return an error code (0 means success). I'd assume that this is an error case? |
||
|
||
/* IV */ | ||
if ((ret = ptls_buffer_reserve(buf, aead->algo->iv_size)) != 0) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure if we can or need to fuzz
quicly_address_token_plaintext_t
, as is not an input from the network. It is a local structure being built with certain restricitons (e.g., quicly_address_t containing a valid sockaddr).