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

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

Merged
merged 1 commit into from
Feb 1, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions sqlx-core/src/sqlite/connection/explain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,24 +89,31 @@ 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();

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;
}
Expand Down Expand Up @@ -239,6 +246,7 @@ pub(super) async fn explain(
}
}

visited[program_i] = true;
program_i += 1;
}

Expand Down