[Cryptography] [FORGED] Re: cryptography Digest, Vol 47, Issue 1

Peter Gutmann pgut001 at cs.auckland.ac.nz
Wed Mar 1 18:01:14 EST 2017


Nemo <nemo at self-evident.org> writes:

>VLAs are part of the C99 standard, which Rule 1 identifies as the source
>language. It would be consistent with this spec to forbid them, but at first
>glance I do not see it. This might be an oversight.

It's not an oversight, it's in the spec, you're just using an obsolete form of
it.  The current spec is quite clear on this:

  Rule 18.8  Variable-length array types shall not be used
  
  Variable-length array types are specified when the size of an array declared
  in a block or a function prototype is not an integer c onstant expression.
  They are typically implemented as a variable size object stored on the
  stack. Their use can therefore make it impossible to determine statically
  the amount of memory that must be reserved for a stack.
  
  If the size of a variable-length array is negative or zero, the behaviour is
  undefined.
  
  If a variable-length array is used in a context in which it is required to
  be compatible with another array type, possibly itself variable-length, then
  the size of the array types shall be identical. Further, all sizes shall
  evaluate to positive integers. If these requirements are not met, the
  behaviour is undefined.
  
  If a variable-length array type is used in the operand of a sizeof operator,
  under some circumstances it is unspecified whether the array size expression
  is evaluated or not.

  [...]

  There is no use of variable-length arrays that is compliant with this rule.
  The examples show some of the undefined behaviour that can arise from their
  use.

  [...]

Peter.


More information about the cryptography mailing list