2,965 karma · joined Sep 19, 2020 (6y ago) · 1,349 submissions
comment 4w ago · link · parent
int crypt2(const char *phrase, const char *setting, char *out);
You can call such a signature "insane" if you want, and that's fine, but it would have averted the bug that is the topic of discussion.comment 4w ago · link · parent
/// Hash the phrase with the given setting.
fn crypt(phrase: &[u8], setting: &[u8]) -> [u8; CRYPT_OUTPUT_SIZE];
Then, in a later version, `crypt` needs to become fallible, so they need to signal errors somehow. But because they really want to preserve backward compatibility, they can't change the output type to `Result<..., ...>`. And so they end up doing the same thing that was done in libcrypt - they output some error value and hackily make sure it's not equal to the `setting` string, under the mistaken assumption that the output of `crypt` would only ever be compared to the `setting` string. And then someone creates the exact same bug.Maybe I'm wrong, but it looks to me like the exact same incentives and means to screw things up exist in C and in Rust for this particular bug.
comment 4w ago · link · parent
> The behavior of crypt on errors isn't well standardized. Some implementations simply can't fail (except by crashing the program), others return a null pointer or a fixed string. Most implementations don't set errno, but some do. POSIX specifies returning a null pointer and setting errno, but it defines only one possible error, ENOSYS, in the case where crypt is not supported at all.
In my opinion the problem is that the behavior of crypt is underspecified - it isn't even specified how it signals failure, which is shocking.
Another disturbing decision that crypt's signature takes in the hash its output is supposed to be compared against - if it weren't for that, this half-baked "on error the output won't compare equal to the input" measure that crypt and crypt_* use wouldn't have been possible.
You can't check errno to see if there was a failure because, as the man page says, the value of errno is unspecified when crypt succeeds.
comment 4w ago · link · parent
But aside from NonZero- and NonNull-based layout optimizations, I don't think Rust is doing anything special to obtain that machine code - it's just relying on LLVM to optimize things.
comment 1mo ago · link · parent
And the average product is solving much easier problems (in terms of low-level programming, which is where the worst bugs tend to be) than a high-performance database.
comment 1mo ago · link · parent
Maybe some math departments could pay OpenAI for access to their models, but I doubt OpenAI would want to deal with most of them.
comment 1mo ago · link · parent
They hack better (faster, at least) than humans if you have thousands of dollars to spend.
Can you afford to spend that money regularly pentesting all the code you have your AI to write for you, though?
And if you can't, then what link is there between being good at hacking, and being good at writing secure code?
(Those aren't rhetorical questions.)
Another one: When will Bun (at this point a mostly Claude-written project, managed by Anthropic themselves) become at least as secure or reliable as Node.js (a mostly human-written project)? If you're right, it should be any day now. And maybe you are right - maybe by tomorrow Claude will have written a formal proof that Bun is memory-safe and it'll never segfault again.
comment 1mo ago · link · parent
Don't the bots still need to do the proof of work for Anubis? They can't "async" their way out of that work.
> Another web is possible but web populists don't really believe it.
How? Sharing knowledge with the world used to be an obviously good thing. Now it's a way to help tech companies replace people with machines. What alternative web could change this state of things?
comment 1mo ago · link · parent
Maybe it's about the joy of learning something new every time you cook. Having Michelin star restaurants in your neighborhood would add to that joy, not take away from it.
> I would like to believe that many people will still choose reality and real relationships.
Why would you like to believe that?
comment 1mo ago · link · parent
We are watching machines rapidly match and surpass humans at countless skills that were considered uniquely human mere months ago - skills that demanded a lot of creativity and insight. Some of our oldest fields of study (e.g., mathematics) are turning into a game of who can spend the most tokens.
I think the humans are entitled to complain a little.