Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Yes! If you really, truly trust your input data, and it is in a single flat array, you can call capnproto::readRootTrusted<MyType>(ptr) instead of setting up a MessageReader. All bounds checks and other validation will be skipped.

But, IMO this is only a good idea for, like, static constants embedded into the source code. Anything you read dynamically could be corrupted if not malicious, and you don't want that to kill your server.

That's up to you, though.



Agreed that bounds checking is the correct default here, but it's nice to know that in true C++ fashion we can shoot our leg off if we so choose.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: