Here we are dealing with a memory safety problem of a type that cannot occur in Rust unless you use `unsafe` blocks. Rust doesn't allow unsafe memory access such as pointer arithmetic or out-of-bounds operations (those produce a runtime panic). C happily accepts those, and the effects may include buffer overflows leading to arbitrary code execution.
This should never, ever be possible when writing a normal program. I love that Rust has named the keyword that enables such things "unsafe", because that's precisely what it is. That C has this behavior as a default is nothing short of madness, though of course C is an artifact of a time when such issues weren't understood as well as they are today.
That being said, whether a runtime panic leads to DoS depends on the execution model. In web applications, threads are usually mapped to connections in some way, and a runtime panic only unwinds the thread it occurs in, so this wouldn't necessarily mean that other users experience service disruptions.
More to the point, I'd expect modern application and/or library code to include default safety checks that prevent scenarios like absurdly large queries from happening in the first place, and provide recoverable errors if such pathological inputs are encountered.
We have seen time and time again that humans aren't good enugh at that task, even in low-level code (and 2x is very buch an outlier).
You may as well be correct about not helping here, but borrow checker provides proofs, not tests; a test can only prove the presence of a bug, while a proof can prove the lack of a certain kind of bug.
1. Accepting user input on a webpage (e.g. a first_name field on a singup form)
2. Storing that user input in a database
Would trigger a RCE if the string was escaped properly.
https://www.sqlite.org/cves.html has a snippet about this, for example.
How do you do this in Firefox? Firefox never implemented WebSQL.
I don't think SQLite needs to be rewritten in any language, tho.
Yes it is!
Rust would help here - not the borrow checker, but the bounds checking.
Sqlite also has never had a severe CVE, from the parent's link:
> All historical vulnerabilities reported against SQLite require at least one of these preconditions:
> The attacker can submit and run arbitrary SQL statements.
> The attacker can submit a maliciously crafted database file to the application that the application will then open and query.
The OP's vulnerability requires passing an insanely long string to a C api, which isn't something you'd expect to be secure.