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 an index out of bounds panic in parse_str #81

Merged
merged 1 commit into from
Mar 6, 2017

Conversation

nygrenh
Copy link
Contributor

@nygrenh nygrenh commented Mar 4, 2017

With specific malformed inputs, like: "F9168C5E-CEB2F4faaFB6BFF329BF39FA1E4", parse_str used to panic with:

"thread '<unnamed>' panicked at 'index out of bounds: the len is 16 but
the index is 16', src/lib.rs:658"

The problem was in the loop that processes input characters: The loop happily writes all valid characters that aren't group delimiters to a buffer. With some cleverly placed hyphens, it was possible to fool the loop into trying to write more bytes to the buffer than is possible.

This problem was found with cargo-fuzz.

With specific malformed inputs, like:
"F9168C5E-CEB2F4faaFB6BFF329BF39FA1E4", parse_str used to panic with:

"thread '<unnamed>' panicked at 'index out of bounds: the len is 16 but
the index is 16', src/lib.rs:658"

The problem was in the loop that processes input characters: The loop happily
writes all valid characters that aren't group delimiters to a buffer.
With some cleverly placed hyphens, it was possible to fool the loop into
trying to write more bytes to the buffer than is possible.
@alexcrichton alexcrichton merged commit 906f3e5 into uuid-rs:master Mar 6, 2017
@alexcrichton
Copy link
Contributor

Thanks!

@nygrenh nygrenh deleted the parse-str-panic branch March 6, 2017 17:03
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.

2 participants