[GRASS-dev] Re: [bug #4725] (grass) nviz crashed while volume visualisation

Soeren Gebbert soerengebbert at gmx.de
Sun Jul 9 10:17:16 EDT 2006


Hi,
On Wednesday 28 June 2006 12:13, Harmish Bowman via RT wrote:
> [ https://intevation.de/rt/webrt?serial_num=4725 ]

> Hi,

> "nviz volume=map3d" segfaults.. see bug report for spearfish example.

> I've traced it back to incorrect mode in  nviz/src/volume.c
> 
> slice_get_drawmode()

> 
> mode=1969841253 (or so)
> 
> when it should be like DM_GOURAUD=256 or DM_FLAT=512

> actual segfault seems to happen after slice_get_drawmode()'s
> 
> return (TCL_ERROR);
> 
> ???

> 
> called from scripts/panel_vol.tcl line ~450:
> 
>     set Nv_(ShadeStyle) [Nvol$curr slice get_drawmode]

> I followed "mode" into lib/ogsf/GVL2.c GVL_slice_get_drawmode()
> 
> and then *gvl to gvl_get_vol() in lib/ogsf/gvl.c, but then I get lost.

> uninit'd variable?
> Hamish

Looks like. 
If nviz is called with -q and a volume + isosurfaces are added -> nviz segfaults.
I have corrected the uninitialized variable:

cvs server: Diffing .
Index: gvl_calc.c
===================================================================
RCS file: /home/grass/grassrepository/grass6/lib/ogsf/gvl_calc.c,v
retrieving revision 1.3
diff -u -r1.3 gvl_calc.c
--- gvl_calc.c  9 Feb 2006 03:08:57 -0000       1.3
+++ gvl_calc.c  9 Jul 2006 13:48:54 -0000
@@ -444,7 +444,7 @@
 {
     int x, y, z;
     int i, a, read;
-    geovol_file *vf;
+    geovol_file *vf = NULL;
     geovol_isosurf *isosurf;

     data_buffer *dbuff;


and it works for me now. But i am not sure if this realy fixed the
problem. 

But there is a second problem. If i start nviz with the option "volume" 
and a valid volume map e.g.: nviz volume=vol
nviz receives a segmentation fault. This seems to be related to this line: 

/home/grass/grassrepository/grass6/visualization/nviz/src/togl_flythrough.c:786
buf_vol = Tcl_GetVar(interp, "volume", TCL_GLOBAL_ONLY);

buf_vol is a NULL pointer and the program segfaults while the atoi(buf_*) calls later.

Something realy strange happens here if a volume map is provided. Maybe the parsing
functionality for volume maps is broken?

I have no clue where this functionality is defined, so i'm not able to fix this. :(

Best
Soeren





More information about the grass-dev mailing list