Re: Sodipodi 0.34 on Amd64 crashes on startup
Lauris Kaplinski <[email protected]> Fri, 13 Feb 2004 20:51:16 +0200
| Newsgroups | gmane.comp.graphics.sodipodi |
|---|---|
| Message-ID | <[email protected]> |
Hello! Patch attached. Not verified thoroughly, but at least compiled and run on 32bit machine :-) Best wishes, Lauris Kaplinski Thomas kirjutas R, 13.02.2004 kell 20:21: > Lauris Kaplinski wrote: > > >Hello! > > > >Hmmm... bad. > >If you have time, you could look into it with debugger - i.e. > >where ecactly it segfault. Maybe that would give a clue. > > > > > My first try: > > $ gdb /usr/local/bin/sodipodi > GNU gdb 5.3-26mdk (Mandrake Linux) > Copyright 2002 Free Software Foundation, Inc. > GDB is free software, covered by the GNU General Public License, and you are > welcome to change it and/or distribute copies of it under certain > conditions. > Type "show copying" to see the conditions. > There is absolutely no warranty for GDB. Type "show warranty" for details. > This GDB was configured as "amd64-mandrake-linux-gnu"... > (gdb) run > Keeping /usr/local/bin/sodipodi... > Starting program: /usr/local/bin/sodipodi > [New Thread 16384 (LWP 31140)] > > Program received signal SIGSEGV, Segmentation fault. > [Switching to Thread 16384 (LWP 31140)] > nr_svp_from_svl (svl=0x0, flat=0x0) at nr-svp.c:74 > 74 svp->length = nsegs; > (gdb) > > Does this give a clue as to where? > > > Thomas > > > ------------------------------------------------------- > SF.Net is sponsored by: Speed Start Your Linux Apps Now. > Build and deploy apps & Web services for Linux with > a free DVD software kit from IBM. Click Now! > http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click > _______________________________________________ > Sodipodi-list mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/sodipodi-list >
sodipodi-64bit-crack.diff
(text/x-patch, 4.2 KB)
Index: src/libnr/nr-path.c
===================================================================
RCS file: /cvs/gnome/sodipodi/src/libnr/nr-path.c,v
retrieving revision 1.14
diff -u -r1.14 nr-path.c
--- src/libnr/nr-path.c 18 Jan 2004 21:04:08 -0000 1.14
+++ src/libnr/nr-path.c 13 Feb 2004 18:51:49 -0000
@@ -94,7 +94,7 @@
break;
}
}
- path = (NRPath *) malloc (sizeof (NRPath) + (nelements - 1) * sizeof (NRPathElement));
+ path = (NRPath *) malloc (sizeof (NRPath) + nelements * sizeof (NRPathElement) - sizeof (NRPathElement));
path->nelements = nelements;
path->offset = 0;
path->nsegments = nsegments;
@@ -670,7 +670,7 @@
nelements = MIN (nelements, 4);
dpath = (NRDynamicPath *) malloc (sizeof (NRDynamicPath));
memset (dpath, 0x0, sizeof (NRDynamicPath));
- dpath->path = (NRPath *) malloc (sizeof (NRPath) + (nelements - 1) * sizeof (NRPathElement));
+ dpath->path = (NRPath *) malloc (sizeof (NRPath) + nelements * sizeof (NRPathElement) - sizeof (NRPathElement));
dpath->path->nelements = 0;
dpath->path->offset = 0;
dpath->path->nsegments = 0;
Index: src/libnr/nr-pathops.c
===================================================================
RCS file: /cvs/gnome/sodipodi/src/libnr/nr-pathops.c,v
retrieving revision 1.18
diff -u -r1.18 nr-pathops.c
--- src/libnr/nr-pathops.c 1 Feb 2004 23:32:51 -0000 1.18
+++ src/libnr/nr-pathops.c 13 Feb 2004 18:51:55 -0000
@@ -261,7 +261,7 @@
{
struct _NRNodePathBuildData ndata;
unsigned int size, i;
- size = sizeof (struct _NRNodePath) + (path->nsegments - 1) * sizeof (struct _NRNodeSeg);
+ size = sizeof (struct _NRNodePath) + path->nsegments * sizeof (struct _NRNodeSeg) - sizeof (struct _NRNodeSeg);
ndata.npath = (struct _NRNodePath *) malloc (size);
ndata.npath->nsegs = path->nsegments;
for (i = 0; i < ndata.npath->nsegs; i++) {
@@ -401,12 +401,13 @@
nr_node_path_concat (struct _NRNodePath *paths[], unsigned int npaths)
{
struct _NRNodePath *npath;
- unsigned int nsegs, segpos, i, j;
+ unsigned int size, nsegs, segpos, i, j;
nsegs = 0;
for (i = 0; i < npaths; i++) {
nsegs += paths[i]->nsegs;
}
- npath = (struct _NRNodePath *) malloc (sizeof (struct _NRNodePath) + (nsegs - 1) * sizeof (struct _NRNodeSeg));
+ size = sizeof (struct _NRNodePath) + nsegs * sizeof (struct _NRNodeSeg) - sizeof (struct _NRNodeSeg);
+ npath = (struct _NRNodePath *) malloc (size);
npath->nsegs = nsegs;
segpos = 0;
for (i = 0; i < npaths; i++) {
@@ -684,7 +685,7 @@
struct _NRNodePath *npath;
unsigned int i0, i1, i;
struct _NRNodeSeg *segs;
- unsigned int sizsegs, numsegs;
+ unsigned int size, sizsegs, numsegs;
/* Step 1 - add nodes to all intersections */
for (i0 = 0; i0 < path->nsegs; i0++) {
struct _NRNodeSeg *seg0, *seg1;
@@ -775,7 +776,8 @@
}
/* Dummy copy */
- npath = (struct _NRNodePath *) malloc (sizeof (struct _NRNodePath) + (numsegs - 1) * sizeof (struct _NRNodeSeg));
+ size = sizeof (struct _NRNodePath) + numsegs * sizeof (struct _NRNodeSeg) - sizeof (struct _NRNodeSeg);
+ npath = (struct _NRNodePath *) malloc (size);
npath->nsegs = numsegs;
for (i = 0; i < numsegs; i++) {
const struct _NRNodeSeg *sseg;
@@ -1097,6 +1099,7 @@
nr_node_path_rewind (struct _NRNodePath *path, int ngroups, int *and, int *or, int *self)
{
struct _NRNodePath *npath;
+ unsigned int size;
int *winds;
int i, j, ss;
int nsegs;
@@ -1127,7 +1130,8 @@
/* Construct index list */
/* Dummy copy */
- npath = (struct _NRNodePath *) malloc (sizeof (struct _NRNodePath) + (nsegs - 1) * sizeof (struct _NRNodeSeg));
+ size = sizeof (struct _NRNodePath) + nsegs * sizeof (struct _NRNodeSeg) - sizeof (struct _NRNodeSeg);
+ npath = (struct _NRNodePath *) malloc (size);
for (i = 0; i < nsegs; i++) {
struct _NRNodeSeg *dseg;
NRPointF dir0, dir1;
Index: src/libnr/nr-svp.c
===================================================================
RCS file: /cvs/gnome/sodipodi/src/libnr/nr-svp.c,v
retrieving revision 1.25
diff -u -r1.25 nr-svp.c
--- src/libnr/nr-svp.c 1 Feb 2004 21:01:29 -0000 1.25
+++ src/libnr/nr-svp.c 13 Feb 2004 18:51:57 -0000
@@ -70,7 +70,7 @@
svl = sl;
}
- svp = malloc (sizeof (NRSVP) + (nsegs - 1) * sizeof (NRSVPSegment));
+ svp = malloc (sizeof (NRSVP) + nsegs * sizeof (NRSVPSegment) - sizeof (NRSVPSegment));
svp->length = nsegs;
if (nsegs > 0) {
unsigned int sidx, pidx;