Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is a pre-memory read in C++?

Tags:

c++

memory

An article I saw today talks about the Rust programming language (being developed by Mozilla) and how it intends to replace C++. One of the cited benefits of Rust is the lack of pre-memory reads. Quoting Mozilla CTO Brendan Eich...

"There's no pre-memory reads" in Rust, he said, but there are in C++. Those problems "lead to a lot of browser vulnerabilities" and would be solved by Rust.

Interestingly, there are only 4 hits on Google right now for the phrase "pre-memory reads", all of which refer to the article itself. What is a pre-memory read in C++ and why is it bad?

like image 494
Michael Kristofik Avatar asked Apr 03 '13 16:04

Michael Kristofik


2 Answers

There appears to have been a correction to the article. The corrected quote is as follows:

He noted that every year browsers fall victim to hacking in the annual Pwn2Own contest at the CanSecWest conference. "There's no free memory reads" in Rust, he said, but there are in C++. Those problems "lead to a lot of browser vulnerabilities" and would be solved by Rust, which is a self-compiling language.

I think this explains it.

like image 160
NPE Avatar answered Nov 06 '22 23:11

NPE


That article also contains this quote, which is clearly wrong:

C++ is unsafe by design," he said. "It gets you down to the metal," a term that means that the code runs natively and doesn't have to be compiled before the CPU can understand it, "but it is unsafe.

So, I think it's safe to say that article is unreliable, and has possibly mis-quoted him.

like image 6
JBentley Avatar answered Nov 07 '22 00:11

JBentley