On 19.09.2019 13:50, Martin Husemann wrote:
> On Thu, Sep 19, 2019 at 01:41:42PM +0200, Kamil Rytarowski wrote:
>> Our version of _CTASSERT does not work as static assert.
> 
> I am not sure what you mean here.
> 
Our _CTASSERT is broken as it is not constant-time expression. We define
VLA which size can be in runtime -1 and trigger UB. Worse than UB is
that it does not validate whether the expression is valid.
>> #include <sys/cdefs.h>
>> int main(int argc, char **argv) { __CTASSERT(argc < 0); return 0; }
> 
> I think this is an abuse of __CTASSERT and should not be supported.
> 
My patch proposal fixes this.
> Martin
> 
Attachment:
signature.asc
Description: OpenPGP digital signature