GithubHelp home page GithubHelp logo

Comments (3)

ctz avatar ctz commented on May 15, 2024

Sorted now. Thanks for the report.

from rustls.

plietar avatar plietar commented on May 15, 2024

Have any benchmark been done to measure the impact of these assertions ?
Intuitively, I would think they would be very negligible compared to the rest of the stuff rustls has to do.

Many of the locations are far away from where a consumer of the library's API can have any influence or control input.

I view assertions as a way to make sure internal invariants of the library are correct, not as a way to validate input. The latter should use Result instead.

This is especially important in a security oriented library, where relying on these invariants to be correct may be critical.

from rustls.

ctz avatar ctz commented on May 15, 2024

Have any benchmark been done to measure the impact of these assertions ?
Intuitively, I would think they would be very negligible compared to the rest of the stuff rustls has to do.

Yes, the benchmarks do not show any measurable performance impact of asserts.

I view assertions as a way to make sure internal invariants of the library are correct, not as a way to validate input. The latter should use Result instead.

Of course. All parsing/untrusted input handling uses Option/Result.

Most of these asserts are executable documentation of internal state -- compiling them out is OK, as they're structurally guaranteed to be true. They're useful in development though, to shake out silly bugs early.

There's also a lot of unwrap() which is equivalent to asserting internal state, but obviously cannot/should not be compiled out. But again, this is not used on untrusted input -- a remote panic is the worst non-crypto error this library could have.

from rustls.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.