Skip to content

fuzzer sapi little memory related fixes here and there. #9480

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions sapi/fuzzer/fuzzer-json.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
data[Size] = '\0';

if (fuzzer_request_startup() == FAILURE) {
free(data);
return 0;
}

Expand Down
1 change: 1 addition & 0 deletions sapi/fuzzer/fuzzer-mbregex.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
data[Size] = '\0';

if (fuzzer_request_startup() == FAILURE) {
free(data);
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion sapi/fuzzer/fuzzer-tracing-jit.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ int LLVMFuzzerInitialize(int *argc, char ***argv) {
"opcache.jit_hot_side_exit=1\n"
"opcache.jit_max_root_traces=32768",
opcache_path);
free(opcache_path);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason why this is delayed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to wait ini_buf is fuzzed first.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The content of opcache_path is copied over, so it's no longer used. IMO it's better to deallocate things early. But I'm certainly not hard-set on this.


create_file();
fuzzer_init_php_for_execute(ini_buf);
free(opcache_path);
return 0;
}
1 change: 1 addition & 0 deletions sapi/fuzzer/fuzzer-unserialize.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
orig_data[Size] = '\0';

if (fuzzer_request_startup() == FAILURE) {
free(orig_data);
return 0;
}

Expand Down
1 change: 1 addition & 0 deletions sapi/fuzzer/fuzzer-unserializehash.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t FullSize) {
orig_data[Size] = '\0';

if (fuzzer_request_startup() == FAILURE) {
free(orig_data);
return 0;
}

Expand Down