Giter Club home page Giter Club logo

Comments (3)

flatcap avatar flatcap commented on September 22, 2024

It's a tricky situation...

Ultimately, I'm running a project with few users.
If something doesn't quite work right, or outright fails, a user might raise an issue.
If NeoMutt crashes, or an assertion fails, the user is more likely to abandon NeoMutt altogether.

This makes me lean towards defensive programming.

Yes, realloc() and friends are a mess, but there are some things we could still do...

  • Perhaps we could flag functions with __attribute__((nonnull)) (as a stepping stone)
    I think Coverity can leverage this sort of thing.

  • There may still be a few custom list implementations that should use TAILQ

  • There are LOTS of arrays that would be safer using ARRAY (gahr's baby).
    Reduce the amount of memory handling to a few "safe" places.


[Aside] - If you want to see a real mess, look at the file-opening code.

from neomutt.

alejandro-colomar avatar alejandro-colomar commented on September 22, 2024

It's a tricky situation...

Ultimately, I'm running a project with few users. If something doesn't quite work right, or outright fails, a user might raise an issue. If NeoMutt crashes, or an assertion fails, the user is more likely to abandon NeoMutt altogether.

This makes me lean towards defensive programming.

Hmmm, I understand.

Yes, realloc() and friends are a mess, but there are some things we could still do...

Well, as long as it works, since it's supposedly dead code, I guess we can keep it dead around; I don't mind too much.

* Perhaps we could flag functions with `__attribute__((nonnull))` (as a stepping stone)
  I think Coverity can leverage this sort of thing.

I'm poking the LLVM people to improve their _Nullable qualifier, which I think is better than [[gnu::nonnull]]. However, it's still not in a usable state. Let's see if we can use that in a few years from now.

* There may still be a few custom list implementations that should use `TAILQ`

* There are LOTS of arrays that would be safer using `ARRAY` (gahr's baby).
  Reduce the amount of memory handling to a few "safe" places.

[Aside] - If you want to see a real mess, look at the file-opening code.

:-)

Thanks!

from neomutt.

ossilator avatar ossilator commented on September 22, 2024

this is exactly the type of thing assert() is for, and static analyzers can make good use of it. attribute((nonnull)) is a specialized variation on that which is also visible outside the function.

just don't use it on unsanitized user-/system-provided data.

from neomutt.

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.