mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 11:48:06 +02:00
progs/demos: Bounds check input to fire.c.
This commit is contained in:
parent
9e98c1fbf6
commit
0c7814fe23
1 changed files with 7 additions and 1 deletions
|
|
@ -726,8 +726,13 @@ main(int ac, char **av)
|
|||
|
||||
maxage = 1.0 / dt;
|
||||
|
||||
if (ac == 2)
|
||||
if (ac == 2) {
|
||||
np = atoi(av[1]);
|
||||
if (np <= 0 || np > 1000000) {
|
||||
fprintf(stderr, "Invalid input.\n");
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
if (ac == 4) {
|
||||
WIDTH = atoi(av[2]);
|
||||
|
|
@ -762,6 +767,7 @@ main(int ac, char **av)
|
|||
|
||||
assert(np > 0);
|
||||
p = (part *) malloc(sizeof(part) * np);
|
||||
assert(p);
|
||||
|
||||
for (i = 0; i < np; i++)
|
||||
setnewpart(&p[i]);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue