Static Analysis Problem Type Reference
The size of a variable size array is less than or equal to zero.
The C99 language extensions permit variable size arrays. Invalid attempts to allocate variable size arrays can lead to this error.
|
ID |
Code Location |
Description |
|---|---|---|
|
1 |
Definition |
The place where the array was defined |
#include <stdio.h>
int f(int size)
{
int a[size];
a[0] = 1;
printf("%d\n", a[0]);
return 0;
}
int main(int argc, char **argv)
{
f(-1); // not good
return 0;
}