I was tracking down a crash in ai_speech.cpp CConceptHistoriesDataOps::Save.
It looks as though m_ConceptHistories is not being iterated over properly?

CUtlDict< ConceptHistory_t, int > *ch = ...;
int count = ch->Count();
for (int i = 0; i < count; i++ ) { ... }

CUtlDict uses a CUtlRBTree for storage and that class has methods
for testing whether an index is valid or not.  Nodes in the tree aren't
stored like an array, so going from 0->count seems wrong.  The correct
way seems to be this:

for ( int i = ch->First(); i != ch->InvalidIndex(); i = ch->Next( i ) )

But there are so many places in the code that iterate over CUtlDicts
from 0->count I'm wondering what is going on here.

_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to