[GRASS5] SegFault in Vect_New_line_struct()

Markus Neteler neteler at geog.uni-hannover.de
Wed Jul 26 16:46:31 EDT 2000


On Wed, Jul 26, 2000 at 04:44:29PM +0200, Michel Wurtz - ENGEES/CEREG wrote:
> David D Gray wrote:
> > 
> > spijker at geo.uu.nl wrote:
> > Almost always an unexpected bomb-out in malloc() or free() is the result
> > of a delayed memory allocation problem. So, not likely anything to do
> > with Vect__new_line_struct().
> > 
> > A likely candidate is m.in.e00/vector.c lines 107, 109, ..., where the
> > x,y arrays overflow by 1 * sizeof(double).
> 
> AAARGH! You're right : when the coverage is in single precision and the
> number of points is odd, odd things may occur in vector.c :-))
> 
> Lines 92,93 are the best candidates for this.  Here is a quick bug fix.
> Markus, can you insert it before the new release ? I am not on the good
> machine for cvs upload.
> 
> ------------------start of patch
> 
> *** vector.c    Wed Jul 26 16:36:12 2000
> --- vector.c~   Wed Jul 26 16:32:06 2000
> ***************
> *** 59,66 ****
>         }
>         if (debug > 4)
>             fprintf( fdlog, "line %d (%d pnts) id=%d\n", j, npts, covnum);
> !       x = (double *)G_malloc( sizeof(double) * (npts+1));
> !       y = (double *)G_malloc( sizeof(double) * (npts+1));
>  
>         if (prec) {     /* double precision : 1 coord pair / line */
>             for (i = 0; i < npts; i++) {
> --- 59,66 ----
>         }
>         if (debug > 4)
>             fprintf( fdlog, "line %d (%d pnts) id=%d\n", j, npts, covnum);
> !       x = (double *)G_malloc( sizeof(double) * npts);
> !       y = (double *)G_malloc( sizeof(double) * npts);
>  
>         if (prec) {     /* double precision : 1 coord pair / line */
>             for (i = 0; i < npts; i++) {
> 
Hi Michel,

this is updated and re-tagged to beta8. Now I have to recompile
and put online. Then go to bed.

Cheers

 Markus

---------------------------------------- 
If you want to unsubscribe from GRASS Development Team mailing list write to:
minordomo at geog.uni-hannover.de with
subject 'unsubscribe grass5'



More information about the grass-dev mailing list