157 karma · joined Sep 26, 2016 (10y ago) · 164 submissions
comment 10y ago · link · parent
[1] shameless plug: https://github.com/duneroadrunner/SaferCPlusPlus
comment 10y ago · link · parent
Perhaps I could instead claim that "item != market.end()" redundantly specifies the vector, "market", and thus presents an unnecessary opportunity for mistakes? For example:
std::vector<double> x_coords;
std::vector<double> y_coords;
...
for (auto y_iter = y_coords.begin(); y_iter != y_coords.end(); y_iter++) {
for (auto x_iter = x_coords.begin(); x_iter != y_coords.end(); x_iter++) {
...
}
}
Notice the "x_iter != y_coords.end()" bug. I assume this will usually trip an assert if it is encountered in debug mode, but not in release mode. Of course you could just as easily mix up "x_iter.hasNext()" with "y_iter.hasNext()", but the removal of redundancy means one less opportunity for a potential mistake. Right? Hmm, I guess that's really an argument for losing the iterators altogether, which I guess was kind of the point of the study.So then wrt iterator invalidation, I have a question. Consider this contrived scenario:
for (auto y_iter = y_coords.begin(); y_iter != y_coords.end(); y_iter++) {
if (5 == std::distance(y_coords.begin(), y_iter)) {
y_coords.resize(3);
}
}
With conventional implementations of std::vector, the "y_coords.resize(3)" will presumably "invalidate" y_iter. And the "y_iter != y_coords.end()" will result in undefined behavior. But you could imagine "safer" implementations of vector<> that would instead throw an exception (or terminate or whatever). (Or you could actually download one of them at the link I gave.) So the question is, if this "safer" implementation supported "y_iter.hasNext()", would it be better for it to throw an exception (or whatever) in this case, or just return false?comment 10y ago · link · parent
Shameless plug: http://duneroadrunner.github.io/SaferCPlusPlus/#msevector
comment 10y ago · link · parent
Right, using Bayes makes the difference not a "fundamental" one, but just a practical one of coming up with the Bayesian prior. Even if it would be hard to establish a consensus on the most appropriate complete set of factors determining the Bayesian prior, there are clearly some examples of meaningful inputs. Like, for example, if you somehow had information about how many of the researcher's previous hypotheses on the subject failed to obtain a "p-value of significance".
But perhaps more practically, you could consider things like the (Kolmogorov) complexity of the hypothesis. Since the number of "low complexity" hypotheses are finite, they are less susceptible to "p-value mining"[1]. The challenge being deciding which inputs to use to evaluate the complexity.
This seems to me like an area where machine learning should be applicable. Rather than lament about the impracticality of determining an appropriate, tractable set of (quantifiable) criteria for determining a Bayesian prior, why not just include every potentially relevant piece of information and let Deep Thought[2] figure out which are actually relevant? So what we really need is unified data about all published results that have been confirmed and discredited.
[1] obligatory xkcd: https://www.xkcd.com/882/
[2] for the youngsters: https://en.wikipedia.org/wiki/List_of_minor_The_Hitchhiker%2...
comment 10y ago · link · parent
I think solutions that don't require any code modification like Softbound and SAFEcode (and even the LLVM sanitizers) aren't popular because the resulting executables are quite slow. Whereas SaferCPlusPlus strives for minimal performance penalty. (Perhaps with some cooperation from C/C++'s formidable optimizing compilers.) (Btw, if it's not already clear, this is a shameless plug.)
And not only is conversion to SaferCPlusPlus far less effort than rewriting everything in another memory safe language, it can be done completely incrementally. What language has better "bidirectional C interoperability" than C++?
comment 10y ago · link · parent
Description:
SaferCPlusPlus is essentially a memory safe dialect of C++. Specifically, it is a library that provides, among other things, safe compatible substitutes for C++'s existing "unsafe" elements (i.e. native pointers and (unchecked) standard library elements). I believe it is currently the highest performing solution for making existing C/C++ code memory safe without requiring any redesigning or re-architecting of the existing code.
A motivating goal is to provide a practical solution for the reduction or elimination of "remote execution" vulnerabilities from much of the internet software infrastructure (web browsers, web servers, crypto libraries, etc.)
Q: What do you hope to build this month?
A1: Convert relevant benchmarks to SaferCPlusPlus to better quantify its performance cost.
A2: If someone's really ambitious, start work on automated conversion from C++ to SaferCPlusPlus.
Q: What kind of skills do you need?
A: C++
Link to GitHub: https://github.com/duneroadrunner/SaferCPlusPlus
License(s): Boost
comment 10y ago · link · parent
[1] https://blog.torproject.org/blog/tor-browser-55a4-hardened-r...
comment 10y ago · link · parent
Also, couldn't distros just provide a version of the library built with the AddressSanitizer[0] enabled as well? It would be slower, but should be much safer. Let the user choose? Not the ultimate solution, but for the short term.
[0] https://github.com/google/sanitizers/wiki/AddressSanitizer
comment 10y ago · link · parent
[0] - https://github.com/duneroadrunner/SaferCPlusPlus (Note: shameless plug.)
comment 10y ago · link · parent
But I find it notable that the concern is still productivity versus performance. In this day and age shouldn't security and correctness have attained at least equal priority? I mean we still live in a world where every single year, every major web browser has at least one new critical "remote code execution" vulnerability reported. I think one thing that's being missed wrt the advent of C++11 is that it is now practical, when appropriate, to write memory safe C++ code that can be compared apples-to-apples with other modern languages. And outperform them. Except for maybe Rust. Maybe.
shameless plug for those interested in memory safe C++ programming: http://www.codeproject.com/Articles/1093894/How-To-Safely-Pa...