[GRASS5] [bug #4178] (grass) r.stats segfault

https://intevation.de/rt/webrt?serial_num=4178

Would it be possible/easier to catch
if(option->answers[0] == NULL )
  G_fatal_error(..);
in parser.c?

Markus

-------------------------------------------- Managed by Request Tracker

Markus Neteler via RT wrote:

https://intevation.de/rt/webrt?serial_num=4178

Would it be possible/easier to catch
if(option->answers[0] == NULL )
  G_fatal_error(..);
in parser.c?

It depends upon whether you want an option to be able to accept a list
of *zero* or more items, distinct from the option being omitted (note
that the parser won't allow a required option to be omitted).

If you want to allow that case, you can't put the check into parser.c;
modules with options which require at least one item must perform the
check themselves.

FWIW, there's no reason why r.series shouldn't be able to handle an
empty list of input maps; it already has to handle the case where all
of the input values for a given cell are null. In practice, an empty
list of input maps would produce an all-zero map for the count and sum
methods, and an all-null map for the other methods.

--
Glynn Clements <glynn@gclements.plus.com>