From c8530493a1b6e773a4d2a16d01e7ed69ae160621 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Thu, 28 Sep 2023 11:06:29 +0200 Subject: Limit expression nesting level to avoid stack overflows --- askama_parser/src/node.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'askama_parser/src/node.rs') diff --git a/askama_parser/src/node.rs b/askama_parser/src/node.rs index a1aa7e2..1ed4e40 100644 --- a/askama_parser/src/node.rs +++ b/askama_parser/src/node.rs @@ -15,6 +15,7 @@ use super::{ bool_lit, char_lit, identifier, is_ws, keyword, num_lit, path_or_identifier, skip_till, str_lit, ws, Expr, PathOrIdentifier, State, }; +use crate::expr::Level; #[derive(Debug, PartialEq)] pub enum Node<'a> { @@ -536,7 +537,7 @@ impl<'a> Call<'a> { cut(tuple(( opt(tuple((ws(identifier), ws(tag("::"))))), ws(identifier), - opt(ws(Expr::arguments)), + opt(ws(|nested| Expr::arguments(nested, Level::default()))), opt(Whitespace::parse), ))), )); -- cgit