News for hackers. Stuff that matters.
Re:Zcoin implementation bug enabled attacker to create over ... by robertgraham on Tuesday March 07, 2017 @02:48AM (#13808916)
It's an absurd point.

ZCash was built upon the Bitcoin codebase. This inherits a lot of bad decisions. Moral purity, demanding they start over again from scratch, just isn't practical.

The bug in question could have been solved had the simply compiled with minimal static analysis -- by which I mean -Wall.

C/C++ is memory safe if you turn on dynamic checking. Sure, it's twice as slow as C/C++, but still tons faster than nonsense languages like Ocaml or Haskell.

Re:Zcoin implementation bug enabled attacker to create over ... by kzrdude on Tuesday March 07, 2017 @08:01AM (#13809975)
No, there is no dynamic checking that guards against iterator invalidation in general. You can't make it memory safe with gcc or clang.
Re:Zcoin implementation bug enabled attacker to create over ... by daira on Tuesday March 07, 2017 @01:59PM (#13813440)
This bug had nothing to do with Zcash. Please correct your comment to say Zcoin, if that's what you meant.

In any case, Zcash is also derived from Bitcoin and builds with `-Werror` (edit: not `-Wall`, but we're working on that). That kind of minimal static analysis is certainly not sufficient to catch the majority of bugs, though.

C++ is not memory safe in any meaningful sense. There have been efforts to define a memory-safe subset, but typical large codebases, including Bitcoin, do not come close to falling within that subset.

Re:Zcoin implementation bug enabled attacker to create over ... by aij on Tuesday March 07, 2017 @12:01PM (#13812093)
> C/C++ is memory safe if you turn on dynamic checking.

What's the option to turn that on? Which compilers is it in?

I know there were several fat-pointer patches to GCC back in the day, but I didn't think anything remotely similar had ever gone mainstream. There's just too much existing code that relies on undefined behavior last I checked.

Re:Zcoin implementation bug enabled attacker to create over ... by im3w1l on Tuesday March 07, 2017 @02:58AM (#13808943)
> C/C++ is memory safe if you turn on dynamic checking.

Is anyone here doing this? Would be interesting to hear your experience.

Re:Zcoin implementation bug enabled attacker to create over ... by jhasse on Tuesday March 07, 2017 @03:31AM (#13809055)
If valgrind counts, then yes.
Re:Zcoin implementation bug enabled attacker to create over ... by kzrdude on Tuesday March 07, 2017 @08:41AM (#13810191)
I'll count valgrind if your program always runs in valgrind. Otherwise it doesn't protect you dynamically.
Re:Zcoin implementation bug enabled attacker to create over ... by jhasse on Tuesday March 07, 2017 @05:40AM (#13809485)
That means CI runs unit tests etc. via

    valgrind --quiet --leak-check=full --error-exitcode=1 *binary*