Hello,

I would like to ask about two places in DEM layer code that I think may be
invalid.

1. vikdemlayer.c:620

Here the code makes sure that array index is not out of bounds, but it
seems that the condition should be 'if(new < 0)' rather than 'if(new < 1)'.
'1' is a valid array index.

// get previous and next column. catch out-of-bound.
gint32 new_x = x;
new_x -= gradient_skip_factor;
if(new_x < 1)
  prevcolumn = g_ptr_array_index ( dem->columns, x+1);
else
  prevcolumn = g_ptr_array_index ( dem->columns, new_x);

2. vikdemlayer.c:787

Here the code draws DEM in UTM mode and is again checking column index, and
I think that it again is making a mistake. The 'x > 0' condition probably
should be replaced with 'x >= 0', because '0' is still a valid array index.

for ( x=start_x, counter.easting = start_eas; [...] ) {
  if ( x > 0 && x < dem->n_columns ) {
    column = g_ptr_array_index ( dem->columns, x );

Please let me know what you think.

Best regards,
Kamil
_______________________________________________
Viking-devel mailing list
Viking-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/viking-devel
Viking home page: http://viking.sf.net/

Reply via email to