Hi,

this patch should fix the bug.

Regards,
Ralf

Ralf Gerlich schrieb:
Hi all,

I did some further analysis on this bug and I found that in line 237 of leaf.cxx

            texcoord = texcoords[ tex_index[i] ];

tex_index[i] is negative in the case of the crash. Specifically, the value in my case is 0xffff8000, which looks like a short-to-int-conversion problem. (Yes, the custom scenery is pretty detailed in some parts and yes, I'm working on a reduction of vertices as well ;-)

IIRC there was a change to the scenery code from short to int some time ago.

Regards,
Ralf
Index: simgear/io/sg_binobj.cxx
===================================================================
RCS file: /var/cvs/SimGear-0.3/source/simgear/io/sg_binobj.cxx,v
retrieving revision 1.8
diff -u -r1.8 sg_binobj.cxx
--- simgear/io/sg_binobj.cxx	1 Oct 2005 11:41:59 -0000	1.8
+++ simgear/io/sg_binobj.cxx	11 Oct 2005 17:16:08 -0000
@@ -240,8 +240,8 @@
 	if ( nbytes > buf.get_size() ) { buf.resize( nbytes ); }
 	char *ptr = buf.get_ptr();
 	sgReadBytes( fp, nbytes, ptr );
-	int count = nbytes / (idx_size * sizeof(short));
-	short *sptr = (short *)ptr;
+	int count = nbytes / (idx_size * sizeof(unsigned short));
+	unsigned short *sptr = (unsigned short *)ptr;
 	int_list vs; vs.clear();
 	int_list ns; ns.clear();
 	int_list cs; cs.clear();
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@flightgear.org
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d

Reply via email to