[Quickfix-developers] Constructing msg from corrupted string
Brought to you by:
orenmnero
From: Brendan B. B. <br...@ka...> - 2004-09-02 17:13:38
|
Hi, Suppose a FIX::Message is constructed from a string and suppose the string is a concatenation of two FIX messages (e.g. suppose you're reading from a log of FIX msgs which somehow was corrupted). In Message::setString(const std::string, bool, const DataDictionary *), w/o the two lines I've added below, this will be an infinite loop as pos will increase through the massage which corresponds to the 'first' message and then reset to a low value when it reaches the 'second' message in the string i.e. pos will never be >= string.size(). while ( pos < string.size() ) { FieldBase field = extractField( string, pos, pDataDictionary ); // Begin brendan, 9/2/04 if (pos < pos2) throw InvalidMessage(); else pos2 = pos; // End brendan, 9/2/04 if ( count < 3 && headerOrder[ count++ ] != field.getField() ) if ( doValidation ) throw InvalidMessage(); ... } Regards, Brendan |