[GRASS-dev] G_get_raster_sample: memory corruption

Florian Kindl Florian.Kindl at uibk.ac.at
Tue Jul 25 10:31:02 EDT 2006


Hello list!

I am hunting after a bug in my program which causes a memory corruption in 
the functions called by G_get_raster_sample. See backtrace and memory map 
below for details.

The arguments passed to G_get_raster_sample appear to be valid.

Any hints what the problem might be?

Thanks in advance,
Florian



=== parameters ===
window: N 270001.000000 S 265000.000000 W -45000.000000 E -39999.000000
fdrast=7 node=1 y=267224.854167 x=-41729.635417
method = NEAREST

=== function call ===
z = G_get_raster_sample( fdrast, &window, NULL, y, x, 0, method );

=== runtime errors ===

*** glibc detected *** flo.strahler: malloc(): memory corruption: 
0x099af2b0 ***
======= Backtrace: =========
/lib/libc.so.6[0x6400ea]
/lib/libc.so.6(calloc+0x91)[0x6411d9]
/home/fkindl/svnrepos/grass6/dist.i686-pc-linux-gnu/lib/libgrass_gis.so(G_calloc+0x2d)[0x11d8fd]
/home/fkindl/svnrepos/grass6/dist.i686-pc-linux-gnu/lib/libgrass_gis.so(G_allocate_d_raster_buf+0x22)[0x11daa2]
/home/fkindl/svnrepos/grass6/dist.i686-pc-linux-gnu/lib/libgrass_gis.so(G_get_raster_sample+0xa7f)[0x14734b]
flo.strahler(StrahFindLeaves+0x2dd)[0x8049b05]
flo.strahler(main+0x2ae)[0x804960a]
/lib/libc.so.6(__libc_start_main+0xdf)[0x5f0d5f]
flo.strahler[0x804904d]

======= Memory map: ========
00111000-00154000 r-xp 00000000 fd:00 297021 
/home/fkindl/svnrepos/grass6/dist.i686-pc-linux-gnu/lib/libgrass_gis.6.1.cvs.so
00154000-00156000 rwxp 00042000 fd:00 297021 
/home/fkindl/svnrepos/grass6/dist.i686-pc-linux-gnu/lib/libgrass_gis.6.1.cvs.so
00156000-0016c000 rwxp 00156000 00:00 0
0016c000-0017a000 r-xp 00000000 fd:00 1769537    /lib/libpthread-2.3.5.so
0017a000-0017b000 r-xp 0000d000 fd:00 1769537    /lib/libpthread-2.3.5.so
0017b000-0017c000 rwxp 0000e000 fd:00 1769537    /lib/libpthread-2.3.5.so
0017c000-0017e000 rwxp 0017c000 00:00 0
00199000-001a0000 r-xp 00000000 fd:00 297040 
/home/fkindl/svnrepos/grass6/dist.i686-pc-linux-gnu/lib/libgrass_dbmiclient.6.1.cvs.so
001a0000-001a1000 rwxp 00007000 fd:00 297040 
/home/fkindl/svnrepos/grass6/dist.i686-pc-linux-gnu/lib/libgrass_dbmiclient.6.1.cvs.so
001c6000-001c9000 r-xp 00000000 fd:00 298587 
/home/fkindl/svnrepos/grass6/dist.i686-pc-linux-gnu/lib/libgrass_pngdriver.6.1.cvs.so
001c9000-001ca000 rwxp 00003000 fd:00 298587 
/home/fkindl/svnrepos/grass6/dist.i686-pc-linux-gnu/lib/libgrass_pngdriver.6.1.cvs.so
001ca000-001cb000 rwxp 001ca000 00:00 0
001f8000-001fe000 r-xp 00000000 fd:00 298569 
/home/fkindl/svnrepos/grass6/dist.i686-pc-linux-gnu/lib/libgrass_datetime.6.1.cvs.so
001fe000-001ff000 rwxp 00006000 fd:00 298569 
/home/fkindl/svnrepos/grass6/dist.i686-pc-linux-gnu/lib/libgrass_datetime.6.1.cvs.so
00213000-0021c000 r-xp 00000000 fd:00 297048 
/home/fkindl/svnrepos/grass6/dist.i686-pc-linux-gnu/lib/libgrass_raster.6.1.cvs.so
0021c000-0021d000 rwxp 00009000 fd:00 297048 
/home/fkindl/svnrepos/grass6/dist.i686-pc-linux-gnu/lib/libgrass_raster.6.1.cvs.so
0025c000-00265000 r-xp 00000000 fd:00 297045 
/home/fkindl/svnrepos/grass6/dist.i686-pc-linux-gnu/lib/libgrass_driver.6.1.cvs.so
00265000-00266000 rwxp 00008000 fd:00 297045 
/home/fkindl/svnrepos/grass6/dist.i686-pc-linux-gnu/lib/libgrass_driver.6.1.cvs.so
00266000-00267000 rwxp 00266000 00:00 0
002ca000-002d6000 r-xp 00000000 fd:00 298599 
/home/fkindl/svnrepos/grass6/dist.i686-pc-linux-gnu/lib/libgrass_dbmibase.6.1.cvs.so
002d6000-002d7000 rwxp 0000c000 fd:00 298599 
/home/fkindl/svnrepos/grass6/dist.i686-pc-linux-gnu/lib/libgrass_dbmibase.6.1.cvs.so
002e7000-002f0000 r-xp 00000000 fd:00 1769524 
/lib/libnss_files-2.3.5.so
002f0000-002f1000 r-xp 00008000 fd:00 1769524 
/lib/libnss_files-2.3.5.so
002f1000-002f2000 rwxp 00009000 fd:00 1769524 
/lib/libnss_files-2.3.5.so
00381000-00390000 r-xp 00000000 fd:00 298652 
/home/fkindl/svnrepos/grass6/dist.i686-pc-linux-gnu/lib/libgrass_dig2.6.1.cvs.so
00390000-00391000 rwxp 0000e000 fd:00 298652 
/home/fkindl/svnrepos/grass6/dist.i686-pc-linux-gnu/lib/libgrass_dig2.6.1.cvs.so
00455000-0046b000 r-xp 00000000 fd:00 8357526 
/usr/local/pgsql/lib/libpq.so.4.0
0046b000-0046c000 rwxp 00015000 fd:00 8357526 
/usr/local/pgsql/lib/libpq.so.4.0
00475000-00488000 r-xp 00000000 fd:00 298648 
/home/fkindl/svnrepos/grass6/dist.i686-pc-linux-gnu/lib/libgrass_dgl.6.1.cvs.so
00488000-00489000 rwxp 00012000 fd:00 298648 
/home/fkindl/svnrepos/grass6/dist.i686-pc-linux-gnu/lib/libgrass_dgl.6.1.cvs.so
00508000-00510000 r-xp 00000000 fd:00 1769590    /lib/librt-2.3.5.so
00510000-00511000 r-xp 00007000 fd:00 1769590    /lib/librt-2.3.5.so
00511000-00512000 rwxp 00008000 fd:00 1769590    /lib/librt-2.3.5.so
00512000-0051c000 rwxp 00512000 00:00 0
0051e000-00523000 r-xp 00000000 fd:00 1769505    /lib/libcrypt-2.3.5.so
00523000-00524000 r-xp 00004000 fd:00 1769505    /lib/libcrypt-2.3.5.so
00524000-00525000 rwxp 00005000 fd:00 1769505    /lib/libcrypt-2.3.5.so
00525000-0054c000 rwxp 00525000 00:00 0
005be000-005d8000 r-xp 00000000 fd:00 1769474    /lib/ld-2.3.5.so
005d8000-005d9000 r-xp 00019000 fd:00 1769474    /lib/ld-2.3.5.so
005d9000-005da000 rwxp 0001a000 fd:00 1769474    /lib/ld-2.3.5.so
005dc000-006ff000 r-xp 00000000 fd:00 1769490    /lib/libc-2.3.5.so
006ff000-00701000 r-xp 00123000 fd:00 1769490    /lib/libc-2.3.5.so
00701000-00703000 rwxp 00125000 fd:00 1769490    /lib/libc-2.3.5.so
00703000-00705000 rwxp 00703000 00:00 0
00707000-0072a000 r-xp 00000000 fd:00 1769507    /lib/libm-2.3.5.so
0072a000-0072b000 r-xp 00022000 fd:00 1769507    /lib/libm-2.3.5.so
0072b000-0072c000 rwxp 00023000 fd:00 1769507    /lib/libm-2.3.5.so
0072e000-00730000 r-xp 00000000 fd:00 1769503    /lib/libdl-2.3.5.so
00730000-00731000 r-xp 00001000 fd:00 1769503    /lib/libdl-2.3.5.so
00731000-00732000 rwxp 00002000 fd:00 1769503    /lib/libdl-2.3.5.so
00734000-00746000 r-xp 00000000 fd:00 7152441    /usr/lib/libz.so.1.2.2.2
00746000-00747000 rwxp 00011000 fd:00 7152441    /usr/lib/libz.so.1.2.2.2
00747000-00888000 r-xp 00000000 fd:00 7172184 
/usr/local/lib/libgeos.so.2.1.4
00888000-0088d000 rwxp 00140000 fd:00 7172184 
/usr/local/lib/libgeos.so.2.1.4
00917000-00918000 r-xp 00917000 00:00 0
00931000-00940000 r-xp 00000000 fd:00 1769509    /lib/libresolv-2.3.5.so
00940000-00941000 r-xp 0000e000 fd:00 1769509    /lib/libresolv-2.3.5.so
00941000-00942000 rwxp 0000f000 fd:00 1769509    /lib/libresolv-2.3.5.so
00942000-00944000 rwxp 00942000 00:00 0
00946000-0094f000 r-xp 00000000 fd:00 1769489 
/lib/libgcc_s-4.0.2-20051126.so.1
0094f000-00950000 rwxp 00009000 fd:00 1769489 
/lib/libgcc_s-4.0.2-20051126.so.1
00952000-00959000 r-xp 00000000 fd:00 7159878 
/usr/lib/libungif.so.4.1.3
00959000-0095a000 rwxp 00006000 fd:00 7159878 
/usr/lib/libungif.so.4.1.3
0095a000-00a2f000 r-xp 00000000 fd:00 7156840 
/usr/lib/libstdc++.so.6.0.7
00a2f000-00a34000 rwxp 000d5000 fd:00 7156840 
/usr/lib/libstdc++.so.6.0.7
00a34000-00a39000 rwxp 00a34000 00:00 0
00a6a000-00a96000 r-xp 00000000 fd:00 297053 
/home/fkindl/svnrepos/grass6/dist.i686-pc-linux-gnu/lib/libgrass_vect.6.1.cvs.so
00a96000-00a97000 rwxp 0002c000 fd:00 297053 
/home/fkindl/svnrepos/grass6/dist.i686-pc-linux-gnu/lib/libgrass_vect.6.1.cvs.so
00aca000-00ad2000 r-xp 00000000 fd:00 7156838 
/usr/X11R6/lib/libSM.so.6.0
00ad2000-00ad3000 rwxp 00007000 fd:00 7156838 
/usr/X11R6/lib/libSM.so.6.0
00ad5000-00aec000 r-xp 00000000 fd:00 7148061 
/usr/X11R6/lib/libICE.so.6.3
00aec000-00aed000 rwxp 00016000 fd:00 7148061 
/usr/X11R6/lib/libICE.so.6.3
00aed000-00aef000 rwxp 00aed000 00:00 0
00af1000-00b0f000 r-xp 00000000 fd:00 7156830 
/usr/lib/libjpeg.so.62.0.0
00b0f000-00b10000 rwxp 0001d000 fd:00 7156830 
/usr/lib/libjpeg.so.62.0.0
00b10000-00be0000 r-xp 00000000 fd:00 7153114 
/usr/X11R6/lib/libX11.so.6.2
00be0000-00be4000 rwxp 000cf000 fd:00 7153114 
/usr/X11R6/lib/libX11.so.6.2
00d46000-00d4e000 r-xp 00000000 fd:00 298595 
/home/fkindl/svnrepos/grass6/dist.i686-pc-linux-gnu/lib/libgrass_display.6.1.cvs.so
00d4e000-00d4f000 rwxp 00007000 fd:00 298595 
/home/fkindl/svnrepos/grass6/dist.i686-pc-linux-gnu/lib/libgrass_display.6.1.cvs.so
00d4f000-00d50000 rwxp 00d4f000 00:00 0
00d52000-00d75000 r-xp 00000000 fd:00 7156836 
/usr/lib/libpng12.so.0.1.2.8
00d75000-00d76000 rwxp 00023000 fd:00 7156836 
/usr/lib/libpng12.so.0.1.2.8
00f18000-00f19000 r-xp 00000000 fd:00 298583 
/home/fkindl/svnrepos/grass6/dist.i686-pc-linux-gnu/lib/libgrass_linkm.6.1.cvs.so
00f19000-00f1a000 rwxp 00000000 fd:00 298583 
/home/fkindl/svnrepos/grass6/dist.i686-pc-linux-gnu/lib/libgrass_linkm.6.1.cvs.so
00fcc000-00fd0000 r-xp 00000000 fd:00 298645 
/home/fkindl/svnrepos/grass6/dist.i686-pc-linux-gnu/lib/libgrass_rtree.6.1.cvs.so
00fd0000-00fd1000 rwxp 00003000 fd:00 298645 
/home/fkindl/svnrepos/grass6/dist.i686-pc-linux-gnu/lib/libgrass_rtree.6.1.cvs.so
00fd1000-012bb000 r-xp 00000000 fd:00 7172243 
/usr/local/lib/libgdal.so.1.10.0
012bb000-01309000 rwxp 002ea000 fd:00 7172243 
/usr/local/lib/libgdal.so.1.10.0
01309000-0131f000 rwxp 01309000 00:00 0
04347000-0439a000 r-xp 00000000 fd:00 7156897    /usr/lib/libtiff.so.3.7.1
0439a000-0439c000 rwxp 00052000 fd:00 7156897    /usr/lib/libtiff.so.3.7.1
04b23000-04b35000 r-xp 00000000 fd:00 1769499    /lib/libnsl-2.3.5.so
04b35000-04b36000 r-xp 00011000 fd:00 1769499    /lib/libnsl-2.3.5.so
04b36000-04b37000 rwxp 00012000 fd:00 1769499    /lib/libnsl-2.3.5.so
04b37000-04b39000 rwxp 04b37000 00:00 0
08048000-0804b000 r-xp 00000000 fd:00 295309 
/home/fkindl/svnrepos/grass6/dist.i686-pc-linux-gnu/bin/flo.strahler
0804b000-0804c000 rw-p 00002000 fd:00 295309 
/home/fkindl/svnrepos/grass6/dist.i686-pc-linux-gnu/bin/flo.strahler
0804c000-0808c000 rw-p 0804c000 00:00 0
09934000-099c4000 rw-p 09934000 00:00 0          [heap]
b7e00000-b7e21000 rw-p b7e00000 00:00 0
b7e21000-b7f00000 ---p b7e21000 00:00 0
b7f38000-b7f40000 rw-p b7f38000 00:00 0
b7f53000-b7f59000 rw-p b7f53000 00:00 0
bff43000-bff59000 rw-p bff43000 00:00 0          [stack]
Aborted



-- 
Florian Kindl
Institute of Geography
University of Innsbruck




More information about the grass-dev mailing list