News for hackers. Stuff that matters.
Re:Why Is SQLite Coded in C and not Rust by miohtama on Wednesday October 15, 2025 @01:16AM (#45588312)
You can find historical SQLite CVEs here

https://www.sqlite.org/cves.html

Note that although code matures the chances of C Human error bugs will never go to zero. We have some bad incidents like Heartbleed to show this.

Re:Why Is SQLite Coded in C and not Rust by hnlmorg on Wednesday October 15, 2025 @02:40AM (#45588825)
Heartbleed was a great demonstration of critical systems that were under appreciated.

Too few maintainers, too security researchers and too little funding.

When writing systems as complicated and as sensitive as the leading encryption suite used globally, no language choice will save you from under resourcing.

Re:Why Is SQLite Coded in C and not Rust by ziotom78 on Wednesday October 15, 2025 @02:00AM (#45588556)
Right, but I believe nobody can claim that Human error bugs go to zero for Rust code.
Re:Why Is SQLite Coded in C and not Rust by john_the_writer on Wednesday October 15, 2025 @03:57AM (#45589351)
Agreed. I rather dislike the idea of "safe" coding languages. Fighting with a memory leak in an elixir app, for the past week. I never viewed c or c++ as unsafe. Writing code is hard, always has been, always will be. It is never safe.
Re:Why Is SQLite Coded in C and not Rust by simonask on Wednesday October 15, 2025 @04:07AM (#45589430)
This is a bit of a misunderstanding.

Safe code is just code that cannot have Undefined Behavior. C and C++ have the concept of "soundness" just like Rust, just no way to statically guard against it.

Re:Why Is SQLite Coded in C and not Rust by gcr on Wednesday October 15, 2025 @08:03AM (#45591103)
Modern compilers like clang and GCC both have static analysis for some of this. Check out the undefined behavior sanitizer.
Re:Why Is SQLite Coded in C and not Rust by humanrebar on Wednesday October 15, 2025 @08:47AM (#45591596)
Sanitizers are technically dynamic analysis. They instrument built programs and analyze them as they run.
Re:Why Is SQLite Coded in C and not Rust by simonask on Wednesday October 15, 2025 @10:34AM (#45593255)
As the other person pointed out, these are two different things. Sanitizers add runtime checks (with zero consideration for performance - don’t use these in productions). Static analysis runs at compile time, and while both GCC and Clang are doing amazing jobs of it, it’s still very easy to run into trouble. The mostly catch the low-hanging fruit.

The technical reason is that Rust-the-language gives the compiler much more information to work with, and it doesn’t look like it is possible to add this information to the C or C++ languages.

Re:Why Is SQLite Coded in C and not Rust by rileymat2 on Wednesday October 15, 2025 @04:10PM (#45597781)
There is more than undefined behavior, if I was to define using an uninitialized variable as yielding whatever data was previously in that location, it is well defined but unsafe.
Re:Why Is SQLite Coded in C and not Rust by oconnor663 on Wednesday October 15, 2025 @08:22PM (#45600086)
That could be well defined for POD types like arrays of bytes (I think in that case they call it "freezing"), but you'd still have undefined behavior if the type in question contained pointers. Also at least in Rust it's UB to create illegal values of certain types, like a bool that's anything other than 0 or 1.

Which is all kind of to say, all of Rust's different safety rules end up being surprisingly densely interconnected. It's really hard to guarantee one of them (say "no use-after-free") without ultimately requiring all of them ("no uninitialized variables", "no mutable aliasing", etc).

Re:Why Is SQLite Coded in C and not Rust by jen20 on Wednesday October 15, 2025 @08:42AM (#45591528)
A memory leak is not a memory safety issue.
Re:Why Is SQLite Coded in C and not Rust by rileymat2 on Wednesday October 15, 2025 @04:11PM (#45597793)
No, but it can be dangerous when you run out of memory for critical systems.
Re:Why Is SQLite Coded in C and not Rust by vrighter on Saturday October 18, 2025 @02:09AM (#45625317)
yes, but that is neither here nor there. You can create a memory leak perfectly cromulently in rust too