struct / mms Goto Github PK
View Code? Open in Web Editor NEWModern Memory Safety in C/C++
License: Other
Modern Memory Safety in C/C++
License: Other
Hey @struct, great job here!
I just wanted to point out two small errors I found while reading the pdf:
Public:
-> public:
dynamic_cast used to upcast Base to Derived
-> dynamic_cast used to upcast Derived to Base
Let me know what you think about it.
Thanks!
SORRY FOR THE SPAM; I keep noting stuff and when you make text super dense people dont read it
Just so you know, in the section about the MSVC sealed modifier you show a class being derived from another class that does not have a virtual destructor; which if you're unaware of can cause some oddities during destruction.
Also, the keyword 'final' is now part of the C++ standard and has the precise effect as sealed. Also, this
causes static binding as opposed to the dynamic binding with a vtable. Meaning you could also could avoid the vtable by simply not marking any methods in the class as being virtual.
Finally, a person could make a relatively sane argument that due to features like libvtv and other related vtable verification implementations that the vtable creates some amount of extra security. The crux of the argument is that one has no vftable verification and makes available a wide range of places to return into whereas the other checks that youre supposed to be calling to that particular call site.
Gday,
I might have missed it, but I didn't see a referen to where one could download the Code_Examples and C_CPP_Training/Vulnerabilities/ directories, where would we find them ?
I can't see Vulnerabilities directory.
do you have plan to add it later?
The Makefile provided in Code_Examples.tar does the following on line 19:
$(CXX) $(CXXFLAGS) $(DEBUG) misc/Compiler_Provided_ROF.cpp -o bin/Compiler_Provided_ROF
however the directory is capitalized in the archive.
First of all, thanks for sharing this! ๐
Would you happen to have the original document (e.g. .pptx) that I could convert myself? The .pdf here doesn't seem to open on my Android devices.
Refs can be null and its more dangerous to use refs than pointers
Prove:
Lets take a following sittuations
void doSomethingPtr(const MyObj * obj)
{
assert(obj);
obj->work();
}
and
void doSomethingRef(const MyObj & obj)
{
obj.work();
}
Now a simplified example when a ref can be null and will cause
huge amount of problems because you never expect it to be null.
void nowCrashEverything()
{
MyObj * obj = NULL;
// many many other lines of code and you forgot that obj is NULL
doSomethingPtr(obj); //the assert will raise and you can see null in debugger.
doSomethingRef(*obj); // something went wrong and you have no idea that it happened. also you will never search in here because ref CAN'T be null :)
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.