If the issue is as simple as you have made it out to be, you have uncovered a bug in SQLite. It would be a great help if you can show the SQL that produces the overrun. A sequence of inputs to the sqlite3.exe shell that reproduces the problem would be best. If it does not reproduce that way, the effort may lead to your own discovery of what you might be giving to sqlite3\_prepare...() that is unexpected and mishandled by the parser/analyzer process. It still represents a bug (most likely), but may narrow the repro quite a bit.