[Common-cvs] util asmrulep.cpp,1.17.6.6,1.17.6.6.18.1

[Common-cvs] util asmrulep.cpp,1.17.6.6,1.17.6.6.18.1

ehyche at helixcommunity.org ehyche at helixcommunity.org
Wed Nov 21 10:11:47 PST 2007


Update of /cvsroot/common/util
In directory cvs01.internal.helixcommunity.org:/tmp/cvs-serv5115

Modified Files:
      Tag: hxclient_2_0_3_cayenne
	asmrulep.cpp 
Log Message:
Merge from HEAD to 203Cay.

Description
---------------------------------------
ASMRuleBook class does not check whether any
rules were actually found when parsing, and
does not check certain variables before deleting them.
Client core was not checking for a number of rules > 0
before allocating structures.

Files Modified
---------------------------------------
common/util/asmrulep.cpp
client/core/asm/hxsmstr.cpp

Branches
---------------------------------------
HEAD, 150Cay, 203Cay, 204Cay, 310Atlas



Index: asmrulep.cpp
===================================================================
RCS file: /cvsroot/common/util/asmrulep.cpp,v
retrieving revision 1.17.6.6
retrieving revision 1.17.6.6.18.1
diff -u -d -r1.17.6.6 -r1.17.6.6.18.1
--- asmrulep.cpp	27 Sep 2005 09:52:07 -0000	1.17.6.6
+++ asmrulep.cpp	21 Nov 2007 18:11:45 -0000	1.17.6.6.18.1
@@ -724,6 +724,9 @@
 
 ASMRuleBook::ASMRuleBook(const char* pRuleBook)
 : m_LastError(HXR_OK)
+, m_pRules(NULL)
+, m_unNumRules(0)
+, m_ulNumThresholds(0)
 , m_pValidRulesArray(NULL)
 , m_pDeletedRulesArray(NULL)
 , m_pRuleBook(NULL)
@@ -749,6 +752,8 @@
     }
 
     m_unNumRules = i;
+    if (i > 0)
+    {
     m_pRules = new ASMRule[i];
     if(!m_pRules)
     {
@@ -772,11 +777,12 @@
 
     m_LastError = Reset();
 }
+}
 
 
 ASMRuleBook::~ASMRuleBook()
 {
-    delete [] m_pRules;
+    HX_VECTOR_DELETE(m_pRules);
     if( m_pValidRulesArray )
     {
        HX_VECTOR_DELETE(m_pValidRulesArray);
@@ -1096,7 +1102,7 @@
 HX_RESULT
 ASMRuleBook::InitRulesArray()
 {
-   if( !m_pValidRulesArray )
+   if( !m_pValidRulesArray && m_unNumRules)
    {
       m_pValidRulesArray = new BOOL[ m_unNumRules ];
       if(!m_pValidRulesArray)
@@ -1109,7 +1115,7 @@
          m_pValidRulesArray[ii] = TRUE;
       }
    }
-   if( !m_pDeletedRulesArray )
+   if( !m_pDeletedRulesArray && m_unNumRules)
    {
       m_pDeletedRulesArray = new BOOL[ m_unNumRules ];
       if(!m_pDeletedRulesArray)
@@ -1446,6 +1452,7 @@
 ASMRuleBook::Reset()
 {
     int i = 0;
+    if (m_pRuleBook)
     { //XXXSMPNOW
 	BOOL bSeenExpression = 0;
 




More information about the Common-cvs mailing list
 

Site Map   |   Terms of Use   |   Privacy Policy   |   Contact Us

Copyright © 1995-2007 RealNetworks, Inc. All rights reserved. RealNetworks and Helix are trademarks of RealNetworks.
All other trademarks or registered trademarks are the property of their respective holders.