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

Program panics if any null byte is encountered. #6

Closed
Uinelj opened this issue Jun 30, 2021 · 2 comments · Fixed by #7
Closed

Program panics if any null byte is encountered. #6

Uinelj opened this issue Jun 30, 2021 · 2 comments · Fixed by #7
Labels
bug Something isn't working

Comments

@Uinelj
Copy link
Contributor

Uinelj commented Jun 30, 2021

When using prediction functions with strings containing a null byte, the library crashes due to an unwrap() on a CString creation.
However, encountering null bytes happens in the nature and while the presence of null bytes could be checked upstream, I don't think that having the program crash is intended behaviour.

This could be fixed by removing unwrap, change return types if applicable and map the error to a String.

I'd be glad to implement such a fix :)

@messense
Copy link
Owner

Thanks for reporting, go ahead fix it I'm happy to accept a PR.

@messense messense added the bug Something isn't working label Jun 30, 2021
@messense
Copy link
Owner

BTW, I think maybe we should use the c_fixed_string crate instead of just CString.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants