[GRASS-dev] Re: [GRASS GIS] #111: r.los fails with high values for
max_dis parameter
GRASS GIS
trac at osgeo.org
Fri Jan 1 07:36:32 EST 2010
#111: r.los fails with high values for max_dis parameter
---------------------------+------------------------------------------------
Reporter: gsancho | Owner: grass-dev at lists.osgeo.org
Type: defect | Status: new
Priority: major | Milestone: 6.4.0
Component: Raster | Version: svn-develbranch6
Resolution: | Keywords: wingrass r.los
Platform: MSWindows XP | Cpu: x86-32
---------------------------+------------------------------------------------
Comment (by hamish):
Replying to [comment:32 pcav]:
> http://int.faunalia.it/~paolo/Toscana_rlos.tar.gz
>
> Tested again with the command
>
> r.los input=dtm at PERMANENT coordinate=1676734,4831167 obs_elev=100
max_dist=10000 output=rlos
>
> and it fails
works for me on debian-etch-pentium4, (& it looks nice too!)
http://bambi.otago.ac.nz/hamish/grass/bugs/rlos_onearth.jpg
but I do see the segfault on debian-lenny-amd64 & GRASS 6.5svn.
gdb session:
{{{
G65> gdb `which r.los`
...
(gdb) run input=dtm at PERMANENT coordinate=1676734,4831167 obs_elev=100
max_dist=10000 output=rlos_test
...
[Thread debugging using libthread_db enabled]
warning: Lowest section in /usr/lib/libicudata.so.38 is .hash at
0000000000000120
Using maximum distance from the viewing point (meters): 10000.000000
[New Thread 0x7fde555ce710 (LWP 31319)]
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fde555ce710 (LWP 31319)]
0x00007fde53ae9ee5 in memcpy () from /lib/libc.so.6
(gdb) bt
#0 0x00007fde53ae9ee5 in memcpy () from /lib/libc.so.6
#1 0x00007fde552eb288 in segment_get (SEG=0x7fff7c5cf320,
buf=0x7fff7c5cdd2c, row=-1,
col=1054) at get.c:49
#2 0x0000000000403b3e in find_inclination (x=0, y=150, viewpt_elev=249,
seg_in_p=0x7fff7c5cf320, row_viewpt=149, col_viewpt=1054, docurv=0,
ellps_a=6.9532466931849492e-310) at pts_elim.c:300
#3 0x000000000040361f in hidden_point_elimination (head=0x16a2340,
viewpt_elev=249,
seg_in_p=0x7fff7c5cf320, seg_out_p=0x7fff7c5cf2e0,
seg_patt_p=0x7fff7c5cf2a0,
quadrant=1, sign_on_y=1, sign_on_x=1, row_viewpt=149, col_viewpt=1054,
patt_flag=0,
docurv=0, ellps_a=6.9532466931849492e-310) at pts_elim.c:94
#4 0x0000000000403de7 in segment (segment_no=4, xmax=149, ymax=506,
slope_1=0,
slope_2=0.5, flip=1, sign_on_y=1, sign_on_x=1, viewpt_elev=249,
seg_in_p=0x7fff7c5cf320, seg_out_p=0x7fff7c5cf2e0,
seg_patt_p=0x7fff7c5cf2a0,
row_viewpt=149, col_viewpt=1054, patt_flag=0, docurv=0,
ellps_a=6.9532466931849492e-310) at segment.c:81
#5 0x0000000000402dc0 in main (argc=6, argv=0x7fff7c5cf778) at main.c:328
(gdb) frame 1
#1 0x00007fde552eb288 in segment_get (SEG=0x7fff7c5cf320,
buf=0x7fff7c5cdd2c, row=-1,
col=1054) at get.c:49
49 memcpy(buf, &SEG->scb[i].buf[index], SEG->len);
(gdb) list
43 int index, n, i;
44
45 segment_address(SEG, row, col, &n, &index);
46 if ((i = segment_pagein(SEG, n)) < 0)
47 return -1;
48
49 memcpy(buf, &SEG->scb[i].buf[index], SEG->len);
50
51 return 1;
52 }
(gdb) bt full
#0 0x00007fde53ae9ee5 in memcpy () from /lib/libc.so.6
No symbol table info available.
#1 0x00007fde552eb288 in segment_get (SEG=0x7fff7c5cf320,
buf=0x7fff7c5cdd2c, row=-1,
col=1054) at get.c:49
index = -476
n = 2
i = 0
}}}
so buf[index] on line 49 of lib/segment/get.c is trying to look for
buf[-476] and generally speaking negative array positions are not allowed.
That row=-1 looks a bit suspicious...
I can follow that back as far as r.los/pts_elim.c L94 where
row_viewpt=149 but neighbor_1_y=150, so row_viewpt - neighbor_1_y = -1.
"g.region res=25 -a" does not fix it.
Hamish
ps- more of the backtrace follows
{{{
#2 0x0000000000403b3e in find_inclination (x=0, y=151, viewpt_elev=250,
seg_in_p=0x7fff36385b80, row_viewpt=150, col_viewpt=1055, docurv=0,
ellps_a=6.9531885513800646e-310) at pts_elim.c:300
del_x = 0
del_y = 151
dist = 3775
picked_pt_elev = 1.40129846e-45
#3 0x000000000040361f in hidden_point_elimination (head=0xf185c0,
viewpt_elev=250,
seg_in_p=0x7fff36385b80, seg_out_p=0x7fff36385b40,
seg_patt_p=0x7fff36385b00,
quadrant=1, sign_on_y=1, sign_on_x=1, row_viewpt=150, col_viewpt=1055,
patt_flag=0,
docurv=0, ellps_a=6.9531885513800646e-310) at pts_elim.c:94
CHECKED_PT = (struct point *) 0xf34df0
BLOCKING_PT = (struct point *) 0xf5f780
orientation_neighbor_1 = 1.5707963267948966
orientation_neighbor_2 = 1.5641297588910283
inclination_neighbor_1 = -0.0080127842385963374
inclination_neighbor_2 = -0.0080487974672544659
interpolated_inclination = 7.8202765736839203e-317
correct_neighbor_inclination = -0.0080487974672544659
correct_neighbor_orientation = 1.5640850181635739
correct_neighbor_x = 1
correct_neighbor_y = 149
neighbor_1_y = 151
neighbor_1_x = 0
neighbor_2_x = 1
neighbor_2_y = 150
uu = 1
vv = 0
mask = 1072693248
#4 0x0000000000403de7 in segment (segment_no=4, xmax=150, ymax=506,
slope_1=0,
slope_2=0.5, flip=1, sign_on_y=1, sign_on_x=1, viewpt_elev=250,
seg_in_p=0x7fff36385b80, seg_out_p=0x7fff36385b40,
seg_patt_p=0x7fff36385b00,
row_viewpt=150, col_viewpt=1055, patt_flag=0, docurv=0,
ellps_a=6.9531885513800646e-310) at segment.c:81
lower_limit_y = 0
upper_limit_y = 0
less = 0
x = 0
y = -1
x_actual = 0
y_actual = 1
x_flip = 0
y_flip = 1
head = (struct point *) 0xf185c0
PRESENT_PT = (struct point *) 0xe8aa50
quadrant = 1
#5 0x0000000000402dc0 in main (argc=6, argv=0x7fff36385fd8) at main.c:328
row_viewpt = 150
col_viewpt = 1055
nrows = 1263
ncols = 1562
a = 506
b = 150
row = 1263
patt_flag = 0
segment_no = 4
flip = 1
xmax = 150
ymax = 506
sign_on_y = 1
sign_on_x = 1
submatrix_rows = 316
submatrix_cols = 391
lenth_data_item = 4
patt = 0
in_fd = 7
out_fd = 8
patt_fd = 0
old = 5
new = 6
slope_1 = 0
slope_2 = 0.5
max_vert_angle = 0
color_factor = 6.9531885516330262e-310
old_mapset = 0xdb3510 "PERMANENT"
patt_mapset = 0x0
value = (FCELL *) 0x7fff36385bc8
search_mapset = 0x404148 ""
current_mapset = 0x7f937cbb1920 "paolo"
...[cut]
}}}
--
Ticket URL: <https://trac.osgeo.org/grass/ticket/111#comment:33>
GRASS GIS <http://grass.osgeo.org>
More information about the grass-dev
mailing list