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

Integer overflow when parsing long URL #870

Closed
Byron opened this issue Oct 15, 2023 · 4 comments
Closed

Integer overflow when parsing long URL #870

Byron opened this issue Oct 15, 2023 · 4 comments

Comments

@Byron
Copy link
Contributor

Byron commented Oct 15, 2023

When parsing the attached URL (long.url.zip) with url::Url::parse() when compiled with overflow checks, there will be an overflow in idna with the panic.

thread '<unnamed>' panicked at /rust/registry/src/index.crates.io-6f17d22bba15001f/idna-0.4.0/src/punycode.rs:272:17:
attempt to add with overflow

Without overflow checks, the same will cause an IdnaError to be created, but won't panic.

Since the URL is very long, I suppose that this issue can be prevented by avoiding to parse unrealistically long host and domain names, which makes this issue related to #868 .

@Byron
Copy link
Contributor Author

Byron commented Oct 30, 2023

I have another URL of this kind, along with a reproducer directly in the Rust playground. The panic only happens in debug mode due to an integer overflow. In release mode, there is an Idna error.

@Byron
Copy link
Contributor Author

Byron commented Nov 2, 2023

Here is another Rust playground example of the same overflow, but using a smaller URL.

@Byron
Copy link
Contributor Author

Byron commented Nov 2, 2023

And another new test-case, which fails in the same spot.

clusterfuzz-testcase-minimized-gix-url-parse-5849655294164992.zip

It's sad that the fuzzer keeps creating new cases for the same issue, and I will stop reporting these here now.

@valenting
Copy link
Collaborator

Fixed by #877

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

No branches or pull requests

2 participants