SQLite is better tested than many silicon chips, so it's hard to fault their testing strategy.
Perhaps a few static analyzers should be run on the codebase to find possible bugs like this.
Then reduce complexity.
SQLite is a complex program, inherently. It's designed to allow users to do complex things, and as such cannot be simpler than its purpose allows.
I'm no formal verification expert—so I don't know if SQLite is above or below that fuzzy threshold—but "reduce complexity" is not always an available tool.
Your confidence as SW engineer. The purpose of a test is to look for unexpected behaviour, not for expected behaviour.
Though clearly there's still unknowns, like when you're throwing random data at an api to see if you can find bugs. But even still, you know what _ways_ you're doing that. Tests generally won't turn up things nobody has thought to test.
You can cast doubt on anything. Will you be alive 30 seconds from now? You don't know for sure! But you can be pretty confident. Similarly, testing can increase confidence in code correctness. SQLite has an excellent security history overall, and it's testing strategy is part of the reason for that success.