NixOS/nix — pull request #74 by epdtry (2012-12-13 05:32:13+00:00)
Title: fix use-after-free bug in mkString(Value&, Symbol&)

The Symbol variant of mkString makes a temporary copy of a std::string from the SymbolTable, then calls c_str() on it and keeps around the resulting pointer, but that pointer becomes invalid as soon as the temporary is destroyed. This change gets rid of the temporary and just calls c_str() directly on the original string.

(Under clang libc++, std::string stores its data on the stack, so it quickly gets overwritten, leading to nasty errors like "invalid character `¿' in name `b¿'".)