Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK-_uh724wZKx7S3bD4T11ZMk=3kF+Vmyk9mhfkBuYf-pSRdHQ@mail.gmail.com>
Date: Fri, 24 Feb 2023 12:32:05 -0500
From: Tamir Duberstein <tamird@...gle.com>
To: enh <enh@...gle.com>
Cc: musl@...ts.openwall.com, NRK <nrk@...root.org>, Rich Felker <dalias@...c.org>
Subject: Re: undefined behavior in fread.c

Clang's qualifiers fail to parse in GCC, so __attribute__((nonnull (1)))
seems like the only somewhat portable solution.

Would you folks actually consider using it?

On Fri, Feb 24, 2023 at 12:07 PM enh <enh@...gle.com> wrote:

>
>
> On Fri, Feb 24, 2023 at 9:00 AM Jₑₙₛ Gustedt <jens.gustedt@...ia.fr>
> wrote:
>
>> Tamir,
>>
>> on Fri, 24 Feb 2023 11:42:30 -0500 you (Tamir Duberstein
>> <tamird@...gle.com>) wrote:
>>
>> > Internal UB means "applying zero offset to null pointer" when the
>> > caller passes (NULL, _, 0, _).
>>
>> So you mean internal misbehavior?
>>
>> > Does such an attribute exist?
>>
>> Yes, gcc has the nonnull old-style attribute, and I think that the C23
>> versions of gcc and clang will have something like `[[gnu::nonnull]]`.
>>
>> Having this as attribute of the function and not of the pointer is a
>> bit unfortunate. For non-void pointers you could also use the `[static
>> 1]` array parameter notation instead of a pointer.
>>
>
> bionic's using clang's _Nullable and _Nonnull, which do let you express
> this:
> https://clang.llvm.org/docs/AttributeReference.html#nullability-attributes
>
>
>> Jₑₙₛ
>>
>> --
>> :: ICube :::::::::::::::::::::::::::::: deputy director ::
>> :: Université de Strasbourg :::::::::::::::::::::: ICPS ::
>> :: INRIA Nancy Grand Est :::::::::::::::::::::::: Camus ::
>> :: :::::::::::::::::::::::::::::::::::: ☎ +33 368854536
>> <+33%203%2068%2085%2045%2036> ::
>> :: https://icube-icps.unistra.fr/index.php/Jens_Gustedt ::
>>
>

Content of type "text/html" skipped

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.