Skip to content

Commit

Permalink
fix(sqlite): GROUP BY in query! cause infinite loop at compile time
Browse files Browse the repository at this point in the history
  • Loading branch information
pymongo authored and mehcode committed Feb 1, 2021
1 parent 2b2418c commit 31abe22
Showing 1 changed file with 8 additions and 0 deletions.
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

0 comments on commit 31abe22

Please sign in to comment.