Hacker News new | past | comments | ask | show | jobs | submit
Lets compare what's inside this Ruby bug, a C function rb_str_casemap which is 40-50 lines of C fiddling with pointers and calling into macros that presumably are familiar to Ruby developers but opaque to an outside viewer. Is it fixed? I guess so but I can't see very well to be sure, it was counting stuff before and now it is being more careful, I hope it's correct this time.

... against str::to_uppercase the Rust function which has a single line of unsafe code, with a two line rationale provided to explain why it's OK to do this. As a subject matter expert I agree with the rationale. LGTM.

Edited: We're talking about uppercase, they're basically mirrors, but we should choose the uppercase function.

This sub-thread in the conversation is about Java, so comparisons to Ruby aren't what's relevant. Here's part of the relevant GP comment.

> It's important to note that Java, like Rust, is generally seen as a memory safe language. But it has bits of assembly, just like Rust has unsafe blocks, to handle some operations.

And according to sources like CISA and the NSA [1], Java is considered memory safe. Furthermore, Rust has been found to have some memory safety issues as well [2]. I think the point to get across is that yes, Rust can help eliminate a very large set of memory safety bugs, but it's prone to issues that other generally considered memory safe languages also have: at some point to do useful work there are going to be unsafe operations. The surface area might be much smaller, so you're likely better off using a memory safe language if you can help it, but it's not a panacea for having layers of security, especially since it means any issue found is likely to affect a large swath of code written in the language because it's in a load bearing area of the language ecosystem.

[1]: https://www.nsa.gov/Press-Room/Press-Releases-Statements/Pre...

[2]: https://www.microsoft.com/en-us/security/blog/2026/11/09/for...

loading story #50562993