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

Fix infinite while loop when buf size is less than 3 #80

Merged
merged 1 commit into from Jan 1, 2023
Merged

Fix infinite while loop when buf size is less than 3 #80

merged 1 commit into from Jan 1, 2023

Conversation

kailes
Copy link
Contributor

@kailes kailes commented Nov 15, 2022

No description provided.

@6xzo
Copy link

6xzo commented Nov 23, 2022

If you add these additional cases to the tests, they hang without this fix.

    #[test]
    fn test_get_unknown() {
        let buf = [];
        assert!(crate::get(&buf).is_none());
// new cases:
        let buf = [0x31];
        assert!(crate::get(&buf).is_none());
        let buf = [0x31, 0x32];
        assert!(crate::get(&buf).is_none());
    }

@kailes
Copy link
Contributor Author

kailes commented Dec 1, 2022

@bojand Hi, have some time to review this?

@bojand bojand merged commit ef46e98 into bojand:master Jan 1, 2023
@bojand
Copy link
Owner

bojand commented Jan 1, 2023

Hello, thanks for the PR. This should be available in v0.12.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants