Hacker News new | past | comments | ask | show | jobs | submit login

> You could say that this is a classical TOCTOU bug as the ctor assumes that a mutable argument does not mutate.

Indeed.

> Protection against these kinds of bugs is only possible with deep copies of mutable arguments or COW semantics.

In the general case yes, but in this case no, you can solve the issue and improve performances by implementing the thing correctly, in a single pass over the input. This way you don’t get a split-brain situation.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: