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

test: add fuzzer for native/js string conversion #51120

Merged
merged 1 commit into from
May 12, 2024

Conversation

AdamKorcz
Copy link
Contributor

Adds a fuzzer for the following APIs:

napi_create_string_utf8
napi_get_value_string_utf8
napi_create_string_latin1
napi_get_value_string_latin1

The PR also adds the fuzzer to Node's OSS-Fuzz build, so that OSS-Fuzz will run this fuzzer continuously.

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/gyp
@nodejs-github-bot nodejs-github-bot added build Issues and PRs related to build files or the CI. needs-ci PRs that need a full CI run. labels Dec 11, 2023
@anonrig anonrig added the request-ci Add this label to start a Jenkins CI on a PR. label Dec 15, 2023
@anonrig anonrig added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Dec 15, 2023
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Dec 15, 2023
@tniessen tniessen added the test Issues and PRs related to the tests. label Dec 15, 2023
Copy link
Member

@joyeecheung joyeecheung left a comment

Choose a reason for hiding this comment

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

This is not tearing down the platform etc. properly. One possibility is copying what v8's fuzzer does and run the teardown in the destructor of a global variable:

https://github.com/nodejs/node/blob/16e03e79688d51f95dfdbc90f5b8f56e3e995c6c/deps/v8/test/fuzzer/fuzzer-support.cc

std::vector<std::string> exec_argv;
std::vector<std::string> errors;

node::InitializeNodeWithArgs(&node_argv, &exec_argv, &errors);
Copy link
Member

@joyeecheung joyeecheung Dec 15, 2023

Choose a reason for hiding this comment

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

Can this just use node::InitializeOncePerProcess() instead? Then there's no need to repeat the initialization routines below (and potentially missing some steps whenever there are internal updates), unless there's a reason that those have to be customized (from what I can tell, that's not necessary?)

@aduh95 aduh95 added the request-ci Add this label to start a Jenkins CI on a PR. label May 10, 2024
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label May 10, 2024
Signed-off-by: Adam Korczynski <adam@adalogics.com>
PR-URL: nodejs#51120
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io>
@aduh95
Copy link
Contributor

aduh95 commented May 12, 2024

Landed in c8805b8

@aduh95 aduh95 merged commit c8805b8 into nodejs:main May 12, 2024
21 checks passed
targos pushed a commit that referenced this pull request May 12, 2024
Signed-off-by: Adam Korczynski <adam@adalogics.com>
PR-URL: #51120
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io>
marco-ippolito pushed a commit that referenced this pull request Jun 17, 2024
Signed-off-by: Adam Korczynski <adam@adalogics.com>
PR-URL: #51120
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io>
marco-ippolito pushed a commit that referenced this pull request Jun 17, 2024
Signed-off-by: Adam Korczynski <adam@adalogics.com>
PR-URL: #51120
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io>
marco-ippolito pushed a commit that referenced this pull request Jun 17, 2024
Signed-off-by: Adam Korczynski <adam@adalogics.com>
PR-URL: #51120
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io>
sophonieb pushed a commit to sophonieb/node that referenced this pull request Jun 20, 2024
Signed-off-by: Adam Korczynski <adam@adalogics.com>
PR-URL: nodejs#51120
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io>
bmeck pushed a commit to bmeck/node that referenced this pull request Jun 22, 2024
Signed-off-by: Adam Korczynski <adam@adalogics.com>
PR-URL: nodejs#51120
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. build Issues and PRs related to build files or the CI. needs-ci PRs that need a full CI run. test Issues and PRs related to the tests.
6 participants