Skip to content
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

Improved Memory Management Proper Resource Cleanup and Freeing Allocated Memory #804

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 49 additions & 39 deletions fuzz/ada_c.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,52 +10,62 @@ int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
* ada_c
*/
ada_url out = ada_parse((char*)data, size);

if (!out) {
return 0;
}

bool is_valid = ada_is_valid(out);

if (!is_valid) {
ada_free(out);
return 0;
}
Shivam7-1 marked this conversation as resolved.
Show resolved Hide resolved

if (is_valid) {
ada_set_href(out, (char*)data, size);
ada_set_host(out, (char*)data, size);
ada_set_hostname(out, (char*)data, size);
ada_set_protocol(out, (char*)data, size);
ada_set_username(out, (char*)data, size);
ada_set_password(out, (char*)data, size);
ada_set_port(out, (char*)data, size);
ada_set_pathname(out, (char*)data, size);
ada_set_search(out, (char*)data, size);
ada_set_hash(out, (char*)data, size);
ada_set_href(out, (char*)data, size);
ada_set_host(out, (char*)data, size);
ada_set_hostname(out, (char*)data, size);
ada_set_protocol(out, (char*)data, size);
ada_set_username(out, (char*)data, size);
ada_set_password(out, (char*)data, size);
ada_set_port(out, (char*)data, size);
ada_set_pathname(out, (char*)data, size);
ada_set_search(out, (char*)data, size);
ada_set_hash(out, (char*)data, size);

ada_get_hash(out);
ada_get_host(out);
ada_get_host_type(out);
ada_get_hostname(out);
ada_get_href(out);
ada_owned_string out_get_origin = ada_get_origin(out);
ada_get_pathname(out);
ada_get_username(out);
ada_get_password(out);
ada_get_protocol(out);
ada_get_port(out);
ada_get_search(out);
ada_get_scheme_type(out);
ada_get_hash(out);
ada_get_host(out);
ada_get_host_type(out);
ada_get_hostname(out);
ada_get_href(out);

ada_has_credentials(out);
ada_has_empty_hostname(out);
ada_has_hostname(out);
ada_has_non_empty_username(out);
ada_has_non_empty_password(out);
ada_has_port(out);
ada_has_password(out);
ada_has_hash(out);
ada_has_search(out);
ada_owned_string out_get_origin = ada_get_origin(out);

ada_get_pathname(out);
ada_get_username(out);
ada_get_password(out);
ada_get_protocol(out);
ada_get_port(out);
ada_get_search(out);
ada_get_scheme_type(out);

ada_get_components(out);
ada_has_credentials(out);
ada_has_empty_hostname(out);
ada_has_hostname(out);
ada_has_non_empty_username(out);
ada_has_non_empty_password(out);
ada_has_port(out);
ada_has_password(out);
ada_has_hash(out);
ada_has_search(out);

ada_clear_port(out);
ada_clear_hash(out);
ada_clear_search(out);
ada_get_components(out);

ada_free_owned_string(out_get_origin);
}
ada_clear_port(out);
ada_clear_hash(out);
ada_clear_search(out);

ada_free_owned_string(out_get_origin);

bool can_parse_result = ada_can_parse((char*)data, size);

Expand Down
Loading