From: <kla...@us...> - 2012-12-30 23:57:52
|
Revision: 13465 http://vegastrike.svn.sourceforge.net/vegastrike/?rev=13465&view=rev Author: klaussfreire Date: 2012-12-30 23:57:45 +0000 (Sun, 30 Dec 2012) Log Message: ----------- Patch 3596011 by log0: cleanup of mesh_bxm after deprecating DLIST stuff Modified Paths: -------------- trunk/vegastrike/src/gfx/mesh_bxm.cpp Modified: trunk/vegastrike/src/gfx/mesh_bxm.cpp =================================================================== --- trunk/vegastrike/src/gfx/mesh_bxm.cpp 2012-12-30 23:55:29 UTC (rev 13464) +++ trunk/vegastrike/src/gfx/mesh_bxm.cpp 2012-12-30 23:57:45 UTC (rev 13465) @@ -65,50 +65,10 @@ } }; -//#define DLIST - -#ifdef DLIST - -#define GL_TRIANGLE (0) -#define GL_QUAD (0) -#define DLISTBEGINSTATE( stat ) \ - do { \ - if ( stat && (laststate != stat) ) { \ - if (laststate != GL_COMPILE) glEnd(); \ - glBegin( stat ); \ - laststate = stat; \ - } \ - } \ - while (0) - -#define DLISTENDSTATE( stat ) \ - do { \ - if ( stat && (laststate != GL_COMPILE) ) { \ - glEnd(); \ - laststate = GL_COMPILE; \ - } \ - } \ - while (0) - -#define DLISTDOVERTEX( num ) \ - do { \ - glTexCoord2f( vtx.s, vtx.t ); \ - glNormal3f( vtx.i, vtx.j, vtx.k ); \ - glVertex3f( vtx.x*xml.scale.i, \ - vtx.y*xml.scale.j, \ - vtx.z*xml.scale.k \ - ); \ - } \ - while (0) - -#else - #define DLISTBEGINSTATE( stat ) #define DLISTDOVERTEX( num ) #define DLISTENDSTATE( stat ) -#endif - //sets up the appropriate lists for the below functions to utilize #define BEGIN_GL_LINES( expectitems ) \ do { \ |
From: <kla...@us...> - 2016-08-15 14:50:22
|
Revision: 13721 http://sourceforge.net/p/vegastrike/code/13721 Author: klaussfreire Date: 2016-08-15 14:50:21 +0000 (Mon, 15 Aug 2016) Log Message: ----------- Harden BFXM loading against corrupted meshes Modified Paths: -------------- trunk/vegastrike/src/gfx/mesh_bxm.cpp Modified: trunk/vegastrike/src/gfx/mesh_bxm.cpp =================================================================== --- trunk/vegastrike/src/gfx/mesh_bxm.cpp 2016-07-08 18:56:02 UTC (rev 13720) +++ trunk/vegastrike/src/gfx/mesh_bxm.cpp 2016-08-15 14:50:21 UTC (rev 13721) @@ -281,20 +281,28 @@ fseek( Inputfile, 4+sizeof (uint32bit), SEEK_SET ); fread( &intbuf, sizeof (uint32bit), 1, Inputfile ); //Length of Inputfile uint32bit Inputlength = VSSwapHostIntToLittle( intbuf ); + if (Inputlength < sizeof(uint32bit)*13 || Inputlength > (1<<30)) { + fprintf( stderr, "Corrupt file %s, aborting\n", Inputfile.GetFilename().c_str() ); + exit( -1 ); + } inmemfile = (chunk32*) malloc( Inputlength+1 ); if (!inmemfile) { - fprintf( stderr, "Buffer allocation failed, Aborting" ); - exit( -1 ); + fprintf( stderr, "Buffer allocation failed, Aborting\n" ); + exit( -2 ); } rewind( Inputfile ); fread( inmemfile, 1, Inputlength, Inputfile ); fcloseInput( Inputfile ); #else uint32bit Inputlength = Inputfile.Size(); + if (Inputlength < sizeof(uint32bit)*13 || Inputlength > (1<<30)) { + fprintf( stderr, "Corrupt file %s, aborting\n", Inputfile.GetFilename().c_str() ); + abort(); + } inmemfile = (chunk32*) malloc( Inputlength ); if (!inmemfile) { - fprintf( stderr, "Buffer allocation failed, Aborting" ); - exit( -1 ); + fprintf( stderr, "Buffer allocation failed, Aborting\n" ); + exit( -2 ); } Inputfile.Read( inmemfile, Inputlength ); Inputfile.Close(); |