fix(sqlite): GROUP BY in query! cause infinite loop at compile time

This commit is contained in:
wuaoxiang 2021-01-21 16:17:38 +08:00 committed by Ryan Leckey
parent 2b2418c6d1
commit 31abe22e34

View File

@ -89,6 +89,7 @@ pub(super) async fn explain(
let mut program_i = 0;
let program_size = program.len();
let mut visited = vec![false; program_size];
let mut output = Vec::new();
let mut nullable = Vec::new();
@ -96,17 +97,23 @@ pub(super) async fn explain(
let mut result = None;
while program_i < program_size {
if visited[program_i] {
program_i += 1;
continue;
}
let (_, ref opcode, p1, p2, p3, ref p4) = program[program_i];
match &**opcode {
OP_INIT => {
// start at <p2>
visited[program_i] = true;
program_i = p2 as usize;
continue;
}
OP_GOTO => {
// goto <p2>
visited[program_i] = true;
program_i = p2 as usize;
continue;
}
@ -239,6 +246,7 @@ pub(super) async fn explain(
}
}
visited[program_i] = true;
program_i += 1;
}