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

Fuzzing askama_parser results in panic #860

Closed
manunio opened this issue Sep 8, 2023 · 3 comments · Fixed by #861
Closed

Fuzzing askama_parser results in panic #860

manunio opened this issue Sep 8, 2023 · 3 comments · Fixed by #861

Comments

@manunio
Copy link
Contributor

manunio commented Sep 8, 2023

Hi, fuzzing askama_parser resulted in panic at following line.
https://github.com/djc/askama/blob/43e92aa3b6b9cd967a70bd0fd54d1f087d6ed76b/askama_parser/src/expr.rs#L290
I suppose it happens because crash input contains Cyrillic letters which are multi-byte and we need exact byte indices to avoid such panic in [..] notation.

#[test]
fn testing() {
    let d = "{eeuuu{b&{!!&{!!11{{
        0!(!1q҄א!)!!!!!!n!";
    if let Ok(_) = Ast::from_str(d, &Syntax::default()) {}
}
running 1 test
thread 'tests::testing' panicked at 'byte index 6 is not a char boundary; it is inside 'א' (bytes 5..7) of `!1q҄א!)!!!!!!n!`', askama_parser/src/expr.rs:290:22
stack backtrace:
@manunio
Copy link
Contributor Author

manunio commented Sep 11, 2023

Hi @djc would you be interested in fuzzing askama at oss-fuzz?

@djc
Copy link
Collaborator

djc commented Sep 11, 2023

Hah, figured that would be the next question. Yes, sounds good!

@manunio
Copy link
Contributor Author

manunio commented Sep 11, 2023

Hah, figured that would be the next question. Yes, sounds good!

Thanks for the approval , Will submit a fuzz target pr here as a next step and then will wait for approval from oss-fuzz team.

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 a pull request may close this issue.

2 participants