Revision: 52935
http://brlcad.svn.sourceforge.net/brlcad/?rev=52935&view=rev
Author: brlcad
Date: 2012-10-10 07:04:33 +0000 (Wed, 10 Oct 2012)
Log Message:
-----------
prevent a crash parsing entities intended for a different schema (e.g., ap204
data fed to ap203e2 schema parser). eDesc was not being initialized causing
random data crash/corruption. even initialized, it ends up being null due to
the schema entity mismatch for unrecognized entities, so have to prevent
against dereferencing null elsewhere.
Modified Paths:
--------------
brlcad/trunk/src/other/step/src/clstepcore/sdaiApplication_instance.cc
Modified: brlcad/trunk/src/other/step/src/clstepcore/sdaiApplication_instance.cc
===================================================================
--- brlcad/trunk/src/other/step/src/clstepcore/sdaiApplication_instance.cc
2012-10-10 07:01:06 UTC (rev 52934)
+++ brlcad/trunk/src/other/step/src/clstepcore/sdaiApplication_instance.cc
2012-10-10 07:04:33 UTC (rev 52935)
@@ -31,12 +31,25 @@
**/
SDAI_Application_instance::SDAI_Application_instance()
- : _cur( 0 ), STEPfile_id( 0 ), headMiEntity( 0 ), nextMiEntity( 0 ),
- _complex( 0 ) {
+ : _cur( 0 ),
+ STEPfile_id( 0 ),
+ p21Comment(std::string("")),
+ eDesc(NULL),
+ headMiEntity( 0 ),
+ nextMiEntity( 0 ),
+ _complex( 0 )
+{
}
SDAI_Application_instance::SDAI_Application_instance( int fileid, int complex )
- : _cur( 0 ), STEPfile_id( fileid ), headMiEntity( 0 ), nextMiEntity( 0 ),
_complex( complex ) {
+ : _cur( 0 ),
+ STEPfile_id( fileid ),
+ p21Comment(std::string("")),
+ eDesc(NULL),
+ headMiEntity( 0 ),
+ nextMiEntity( 0 ),
+ _complex( complex )
+{
}
SDAI_Application_instance::~SDAI_Application_instance() {
@@ -49,7 +62,7 @@
attr->refCount --;
if (attr->refCount <= 0)
delete attr;
- }
+ }
} while (attr);
@@ -72,6 +85,9 @@
_error.GreaterSeverity( SEVERITY_BUG );
return S_ENTITY_NULL;
} else {
+ if (!eDesc)
+ return S_ENTITY_NULL;
+
SDAI_Application_instance * seNew = eDesc->NewSTEPentity();
seNew -> CopyAs( this );
return seNew;
@@ -201,6 +217,8 @@
const char * SDAI_Application_instance::EntityName( const char * schnm ) const
{
+ if (!eDesc)
+ return NULL;
return eDesc->Name( schnm );
}
@@ -209,6 +227,8 @@
****************************************************************/
const EntityDescriptor * SDAI_Application_instance::IsA( const
EntityDescriptor * ed ) const {
+ if (!eDesc)
+ return NULL;
return ( eDesc->IsA( ed ) );
}
@@ -375,13 +395,17 @@
if( writeComments && !p21Comment.empty() ) {
out << p21Comment;
}
- if( mixedCase ) {
- out << "#" << STEPfile_id << " "
- << eDesc->QualifiedName( s ) << endl;
- } else {
- out << "#" << STEPfile_id << " "
- << StrToUpper( eDesc->QualifiedName( s ), tmp ) << endl;
+
+ if (eDesc) {
+ if( mixedCase) {
+ out << "#" << STEPfile_id << " "
+ << eDesc->QualifiedName( s ) << endl;
+ } else {
+ out << "#" << STEPfile_id << " "
+ << StrToUpper( eDesc->QualifiedName( s ), tmp ) << endl;
+ }
}
+
int n = attributes.list_length();
for( int i = 0 ; i < n; i++ ) {
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits