2,355 karma · joined Dec 14, 2020 (5y ago) · 1,116 submissions
comment 20h ago · link · parent
> Suppose there is a point in the code where the compiler can't verify that it's safe to access the object but you want to do it anyway. You've transferred ownership of it to e.g. a third party library, while still keeping and using a naughty reference to it. Avoiding this would require you to restructure the code, which could be a lot of work. But the boss wants you to do it now instead of all the refactoring needed to do it right.
That's exactly what I thought every time I added 'unsafe' where I "knew" it was fine, even though the compiler told me I couldn't. And the vast majority of those times, within a day, I had to track down "the program now segfaults erratically". It's not _every_ time, but the vast majority of them. Certainly enough that when I now get into the same situation, the easier option is to make it certain that the object isn't being freed (wrap it in a refcount and call it a day, no unsafe in sight).
comment 1d ago · link · parent
It's usually the opposite. If you're being forced to write unsafe, odds are there's a crash bug about to appear (the word "forced" was very specifically chosen, I've been in both of these positions quite a few times).
And if you're not being forced to write unsafe, not writing it really is easier. Precedence of operations means that if you want to call a method/access a field of a raw pointer, it's a minimum of `(*a).` to access it. A reference is just the `.`.
comment 3d ago · link · parent
You've described something that's not "code execution", and I've agreed several times. I'm making fun of the fact that a "local privilege escalation" is turned into a "remote" attack if it's emailed and run/executed/parsed, much like an email signature.
comment 3d ago · link · parent
If not, and all exploits are attacker controlled, it sounds like all exploits are RCE.
EDIT I guess I have to weaken the last condition since we haven't proved all exploits are "code execution", but we have at least proved all exploits are "remote".
comment 4d ago · link · parent
They are getting _something_ that they're happy about, and they're not all blind to alternatives.
comment 4d ago · link · parent
So it's the "oh no, I realise now that I needed to commit before I made all those changes" situation, but since the workspace gets snapshot/committed on every jj command, nothing was lost.
comment 4d ago · link · parent
At the start of the day, I resumed working on a feature; there's no staging, so modifications I make are all stored as the current change.
Later that day I realised I needed to actually save the version of the feature that existed when I started work that morning.
So into the evolog I go (`jj evolog`). It's a record of all commits that a change has been; I could scroll back through the recorded changes, find the first change made that day, and then 'jj new' to create a change that represents that work.
It felt magical, to just be able to jump back to a project state that I didn't explicitly record, then save it.
comment 5d ago · link · parent
comment 5d ago · link · parent
https://devblogs.microsoft.com/oldnewthing/20200804-00/?p=10...
https://devblogs.microsoft.com/oldnewthing/20241007-00/?p=11...
comment 1w ago · link · parent
Their opening point was concern about solar power displacing agricultural use for land, while comments here talk about using it to provide shade to cattle. Doesn't seem like a particularly good argument.
comment 1w ago · link · parent
I could understand them showing off crash recovery by using code deliberately written to crash the language server, and so not being something you can "fix".
comment 1w ago · link · parent
> I think it's clear consent was given at some point
That's not what was found. I don't know the facts of the case, but it's possible that "consent" mechanisms were found to be insufficient. As an example, if you ask for permission for one purpose, then use it for another, that would probably not meet the "inform users" bar.