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

--zip-out triggers segfault if not provided with an integer value #330

Closed
bs-az opened this issue May 20, 2022 · 2 comments
Closed

--zip-out triggers segfault if not provided with an integer value #330

bs-az opened this issue May 20, 2022 · 2 comments
Labels

Comments

@bs-az
Copy link

bs-az commented May 20, 2022

Here is the doc-string for --zip-out:

    --zip-out         STR/BOOL    Optional  Controls the output compression                       Yes/True

       By default the report files are produced in the same format as the input i.e.
       if the reads files are compressed (gz), the output is also compressed.
       The default behaviour can be overriden by using '-zip-out'.
       The possible values: Y(es), N(o), T(rue), F(alse). No value means 'True'.
       The values are Not case sensitive i.e. 'Yes, YES, yEs, Y, y' are all OK
       Examples:
       '-reads freads.gz -zip-out n' : generate flat output when the input is compressed
       '-reads freads.flat -zip-out' : compress the output when the input files are flat

This is inconsistent with the source code at options.cpp#L1139

void Runopts::opt_zip_out(const std::string& val)
{
	if (val.size() > 0) {
		auto ii = std::stoi(val);
		if (!(ii == -1 || ii == 0 || ii == 2)) {
			WARN("'", OPT_ZIP_OUT, "' can only take integer values: [", -1, ", ", 0, ", ", 1, "]. Provided value: ", val, " Using default: ", zip_out);
		}
		else {
			INFO("using '", OPT_ZIP_OUT, "' with specified value ", ii);
			zip_out = ii;
		}
	}
}

std::stoi will trigger a segfault when provided with e.g. --zip-out No

@biocodz
Copy link
Collaborator

biocodz commented May 22, 2022

Good catch! Thanks for reporting.

@biocodz biocodz added the bug label May 22, 2022
@biocodz
Copy link
Collaborator

biocodz commented May 30, 2022

Fixed in commit 580d0872b1f144fbf81d7987124c693f6cbda12a. To appear in release 4.3.5 (soon)

@bs-az bs-az closed this as completed Aug 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants