SQLite: 92 million lines of tests
Dijkstra: Tests can only prove the presence of bugs, never their absence!
I admit to curiosity as to whether static analysis could have caught this. E.g., Rust's type system (yeah yeah I know) catches all data races, unless they originate in unsafe code, which this one might or might not have; a hypothetical Rust SQLite would probably need a lot of unsafe (https://github.com/tursodatabase/turso has 556 unsafe blocks in the core), and I don't have a sense of whether the particular part that contained this bug would be included in that.
It can prove absence of specific bugs though.
Donald Knuth: Beware of bugs in the above code; I have only proved it correct, not tried it.
Everyone knows that tests don't prevent all bugs. But they are very good at preventing known bugs from recurring in the future.