From c930f286439efc7193dcc0955fc96feee77d85f2 Mon Sep 17 00:00:00 2001 From: Jussi Saurio Date: Tue, 9 Sep 2025 00:00:19 +0300 Subject: [PATCH 1/2] Handle case where null flag is set in op_column --- core/vdbe/execute.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/core/vdbe/execute.rs b/core/vdbe/execute.rs index 0c6db224d..bc7cb3f99 100644 --- a/core/vdbe/execute.rs +++ b/core/vdbe/execute.rs @@ -1455,13 +1455,16 @@ pub fn op_column( index_cursor_id, table_cursor_id, } => { - let rowid = { + let Some(rowid) = ({ let index_cursor = state.get_cursor(index_cursor_id); let index_cursor = index_cursor.as_btree_mut(); return_if_io!(index_cursor.rowid()) + }) else { + state.registers[*dest] = Register::Value(Value::Null); + break 'outer; }; state.op_column_state = OpColumnState::Seek { - rowid: rowid.unwrap(), + rowid, table_cursor_id, }; } From b01033975a390b505b135740d3daea5f88cca00a Mon Sep 17 00:00:00 2001 From: Jussi Saurio Date: Tue, 9 Sep 2025 00:11:19 +0300 Subject: [PATCH 2/2] regression test for crash in op_column --- testing/join.test | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/testing/join.test b/testing/join.test index 034719b1f..e0fbd436d 100755 --- a/testing/join.test +++ b/testing/join.test @@ -329,3 +329,13 @@ do_execsql_test_on_specific_db {:memory:} next-crash { select a.x, b.x, c.x from a left join b on a.y=b.x left join c on b.y=c.x; } {1|| 2||} + +# regression test for crash in op_column +do_execsql_test_on_specific_db {:memory:} left-join-column-crash { + create table a(x int primary key,y); + create table b(x int primary key,y); + insert into a values (1,1),(2,2); + insert into b values (3,3),(4,4); + select * from a left join b on a.x < 2 where a.x < 3 and b.x < 12; +} {1|1|3|3 +1|1|4|4} \ No newline at end of file