Commit 6053bde
committed
Add regression tests for statement NULL-dereference
After Sqlite3.release(conn, stmt) sets statement->statement = NULL:
- exqlite_step: calls sqlite3_step(NULL) — returns SQLITE_MISUSE by
SQLite's internal guard, so the test already passes, but the guard
should be explicit in the NIF.
- exqlite_columns: calls sqlite3_column_count(NULL) which returns 0,
causing columns/2 to return {:ok, []} instead of {:error, _}.
This test is RED — it currently fails with {:ok, []}.
- exqlite_multi_step: the pre-lock !statement->statement check at
line 773 catches the sequential case; the test documents the
expected {:error, _} behavior and the TOCTOU race window.
The bind_*/reset/errmsg NULL guards share the same pattern and will
be fixed in the same GREEN commit.1 parent 4aa6a44 commit 6053bde
1 file changed
Lines changed: 51 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
977 | 977 | | |
978 | 978 | | |
979 | 979 | | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
980 | 1031 | | |
0 commit comments