Bugfix - prevent infinite parser recursion in stmts & binary exprs. (#2675)

This commit is contained in:
Finn Bear 2023-09-12 04:03:52 -07:00 committed by GitHub
parent 82e0d85da0
commit bbc077fc0e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2707,6 +2707,7 @@ impl TryNeg for Value {
pub fn value(i: &str) -> IResult<&str, Value> { pub fn value(i: &str) -> IResult<&str, Value> {
let (i, start) = single(i)?; let (i, start) = single(i)?;
if let (i, Some(o)) = opt(operator::binary)(i)? { if let (i, Some(o)) = opt(operator::binary)(i)? {
let _diving = crate::sql::parser::depth::dive(i)?;
let (i, r) = cut(value)(i)?; let (i, r) = cut(value)(i)?;
let expr = match r { let expr = match r {
Value::Expression(r) => r.augment(start, o), Value::Expression(r) => r.augment(start, o),
@ -2837,6 +2838,7 @@ pub fn select(i: &str) -> IResult<&str, Value> {
/// Used in CREATE, UPDATE, and DELETE clauses /// Used in CREATE, UPDATE, and DELETE clauses
pub fn what(i: &str) -> IResult<&str, Value> { pub fn what(i: &str) -> IResult<&str, Value> {
let _diving = crate::sql::parser::depth::dive(i)?;
let (i, v) = alt(( let (i, v) = alt((
into(idiom::multi_without_start), into(idiom::multi_without_start),
function_or_const, function_or_const,