coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: baseN: new program suggestion (various 'base' encoding)


From: Pádraig Brady
Subject: Re: baseN: new program suggestion (various 'base' encoding)
Date: Sun, 13 Jan 2019 22:16:51 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

On 04/01/19 14:09, Bernhard Voelker wrote:
> On 1/4/19 10:36 PM, Pádraig Brady wrote:
>> On 04/01/19 13:07, Bernhard Voelker wrote:
>>> On 1/4/19 6:38 PM, Pádraig Brady wrote:
>>>> I wonder should we avoid VLAs in coreutils altogether?
>>>> I.E. add -Werror=vla. The kernel has done this for security reaons.
>>>
>>> Well, why not?  The only problem is still the one mentioned in 
>>> 'configure.ac':
>>>
>>>   nw="$nw -Wvla"                    # warnings in gettext.h
>>>
>>> With -Werror=vla, we get a lot of warnings, but all originate from
>>> these 2 places in gettext.h:
>>>
>>>   ./lib/gettext.h: In function 'dcpgettext_expr':
>>>   ./lib/gettext.h:220:3: error: ISO C90 forbids variable length array 
>>> 'msg_ctxt_id' [-Werror=vla]
>>>      char msg_ctxt_id[msgctxt_len + msgid_len];
>>>      ^~~~
>>>   ./lib/gettext.h: In function 'dcnpgettext_expr':
>>>   ./lib/gettext.h:268:3: error: ISO C90 forbids variable length array 
>>> 'msg_ctxt_id' [-Werror=vla]
>>>      char msg_ctxt_id[msgctxt_len + msgid_len];
>>>      ^~~~
>>
>> It should be sufficient to also
>>
>>   #define __STDC_NO_VLA__ 1
>>
> 
> No, that is inactive in gettext.h;
> 
> 
>   #if (((__GNUC__ >= 3 || __GNUG__ >= 2) && !defined __STRICT_ANSI__) \
>        /* || (__STDC_VERSION__ == 199901L && !defined __HP_cc)
>           || (__STDC_VERSION__ >= 201112L && !defined __STDC_NO_VLA__) */ )
>   # define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 1
>   #else
>   # define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 0
>   #endif
> 
> See Bruno's comment in gnulib commit a750b78e69:
> 
>   * lib/gettext.h (_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS): Extend comment
>   to include the theoretical condition for availability of variable size
>   arrays, if we could trust the value of __STDC_VERSION__.

Ok I've sent a gnulib patch to support disbling VLA use with GNULIB_NO_VLA,
which is enabled in coreutils with the attached.

cheers,
Pádraig

Attachment: coreutils-no-vla.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]