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

scylla $tool crashes if invoked without further args #16451

Closed
denesb opened this issue Dec 18, 2023 · 1 comment · Fixed by #16456
Closed

scylla $tool crashes if invoked without further args #16451

denesb opened this issue Dec 18, 2023 · 1 comment · Fixed by #16456
Assignees
Milestone

Comments

@denesb
Copy link
Contributor

denesb commented Dec 18, 2023

Reproducer:

$ scylla nodetool
Segmentation fault (core dumped)

If any further args are passed, the crash doesn't happen.

The reason for the crash is unconditional dereferencing of argv[1] in

if (std::strncmp(argv[1], "--help", 6) != 0 && std::strcmp(argv[1], "-h") != 0) {

Affected branches: 5.4+

@denesb denesb self-assigned this Dec 18, 2023
xemul added a commit that referenced this issue Dec 20, 2023
…from Botond Dénes

Currently, `tool_app_template::run_async()` crashes when invoked with empty argv (with just `argv[0]` populated). This can happen if the tool app is invoked without any further args, e.g. just invoking `scylla nodetool`. The crash happens because unconditional dereferencing of `argv[1]` to get the current operation.

To fix, add an early-exit for this case, just printing a usage message and exiting with exit code 2.

Fixes: #16451

Closes #16456

* github.com:scylladb/scylladb:
  test: add regression tests for invoking tools with no args
  tools/utils: tool_app_template: handle the case of no args
  tools/utils: tool_app_template: remove "scylla-" prefix from app name
avikivity pushed a commit that referenced this issue Dec 20, 2023
…from Botond Dénes

Currently, `tool_app_template::run_async()` crashes when invoked with empty argv (with just `argv[0]` populated). This can happen if the tool app is invoked without any further args, e.g. just invoking `scylla nodetool`. The crash happens because unconditional dereferencing of `argv[1]` to get the current operation.

To fix, add an early-exit for this case, just printing a usage message and exiting with exit code 2.

Fixes: #16451

Closes #16456

* github.com:scylladb/scylladb:
  test: add regression tests for invoking tools with no args
  tools/utils: tool_app_template: handle the case of no args
  tools/utils: tool_app_template: remove "scylla-" prefix from app name
@mykaul mykaul added the backport/5.4 Issues that should be backported to 5.4 branch once they'll be fixed label Dec 25, 2023
denesb pushed a commit that referenced this issue Jan 4, 2024
…from Botond Dénes

Currently, `tool_app_template::run_async()` crashes when invoked with empty argv (with just `argv[0]` populated). This can happen if the tool app is invoked without any further args, e.g. just invoking `scylla nodetool`. The crash happens because unconditional dereferencing of `argv[1]` to get the current operation.

To fix, add an early-exit for this case, just printing a usage message and exiting with exit code 2.

Fixes: #16451

Closes #16456

* github.com:scylladb/scylladb:
  test: add regression tests for invoking tools with no args
  tools/utils: tool_app_template: handle the case of no args
  tools/utils: tool_app_template: remove "scylla-" prefix from app name

(cherry picked from commit 5866d26)
@denesb
Copy link
Contributor Author

denesb commented Jan 4, 2024

Backported to 5.4.

@denesb denesb removed Backport candidate backport/5.4 Issues that should be backported to 5.4 branch once they'll be fixed labels Jan 4, 2024
@mykaul mykaul added this to the 6.0 milestone Jan 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants